Skip to content

Add more offset displays #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 86 additions & 6 deletions skso.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,31 @@
#include <linux/net.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/fdtable.h>
#include <linux/version.h>
#include <net/tcp.h>

int STRUCT_TCP_SOCK_COPIED_SEQ_OFFSET(void)
int struct_tcp_sock__copied_seq_offset(void)
{
return offsetof(typeof(struct tcp_sock), copied_seq);
}

int STRUCT_TCP_SOCK_WRITE_SEQ_OFFSET(void)
int struct_tcp_sock__write_seq_offset(void)
{
return offsetof(typeof(struct tcp_sock), write_seq);
}

int STRUCT_TASK_FILES_OFFSET(void)
int struct_tcp_sock__snd_nxt_offset(void)
{
return offsetof(typeof(struct tcp_sock), snd_nxt);
}

int struct_task_struct__files_offset(void)
{
return offsetof(typeof(struct task_struct), files);
}

int STRUCT_SOCK_FLAGS_OFFSET(void)
int struct_sock____sk_flags_offset_offset(void)
{
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
return offsetof(typeof(struct sock), __sk_flags_offset);
Expand All @@ -34,14 +40,88 @@ int STRUCT_SOCK_FLAGS_OFFSET(void)
#endif
}

int struct_files_struct_fdt_offset(void)
{
return offsetof(typeof(struct files_struct), fdt);
}

int STRUCT_FILES_PRIVATE_DATA_OFFSET(void)
{
return offsetof(typeof(struct file), private_data);
}

int STRUCT_TASK_TLS_OFFSET(void)
int struct_file__f_inode_offset(void)
{
return offsetof(typeof(struct file), f_inode);
}

int struct_inode__i_mode_offset(void)
{
return offsetof(typeof(struct inode), i_mode);
}

int struct_file__dentry__sum_offset(void)
{
return offsetof(typeof(struct file),
f_path) + offsetof(typeof(struct path), dentry);
}

int struct_dentry_name__sum__offset(void)
{
return offsetof(typeof(struct dentry),
d_name) + offsetof(typeof(struct qstr), name);
}

int struct_sock_common__skc_family_offset(void)
{
return offsetof(typeof(struct sock_common), skc_family);
}

int struct_sock_common__skc_rcv_saddr_offset(void)
{
return offsetof(typeof(struct sock_common), skc_rcv_saddr);
}

int struct_sock_common__skc_daddr_offset(void)
{
return offsetof(typeof(struct sock_common), skc_daddr);
}

int struct_sock_common__skc_v6_rcv_saddr_offset(void)
{
return offsetof(typeof(struct sock_common), skc_v6_rcv_saddr);
}

int struct_sock_common__skc_v6_daddr_offset(void)
{
return offsetof(typeof(struct sock_common), skc_v6_daddr);
}

int struct_sock_common__skc_dport_offset(void)
{
return offsetof(typeof(struct sock_common), skc_dport);
}

int struct_sock_common__skc_num_offset(void)
{
return offsetof(typeof(struct sock_common), skc_num);
}

int struct_sock_common__skc_state_offset(void)
{
return offsetof(typeof(struct sock_common), skc_state);
}

int struct_sock_common__skc_ipv6only_offset(void)
{
return offsetof(typeof(struct sock_common), skc_state) + 1;
}

int struct_task_struct__tls_offset(void)
{
return offsetof(typeof(struct task_struct), thread) + offsetof(typeof(struct thread_struct), fsbase);
return offsetof(typeof(struct task_struct),
thread) + offsetof(typeof(struct thread_struct),
fsbase);
}

static int init_skso(void)
Expand Down