diff --git a/skso.c b/skso.c index 3a0b788..06e0167 100644 --- a/skso.c +++ b/skso.c @@ -7,25 +7,31 @@ #include #include #include +#include #include #include -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); @@ -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)