From 1944a49fd87d74b3582af13b2b7985bf53e147ef Mon Sep 17 00:00:00 2001 From: liankong Date: Sun, 13 Apr 2025 14:18:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0super=5Faccess=E5=AF=B9task?= =?UTF-8?q?=5Fstruct=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/kpm/super_access.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/kernel/kpm/super_access.c b/kernel/kpm/super_access.c index 718f0113..0829bfda 100644 --- a/kernel/kpm/super_access.c +++ b/kernel/kpm/super_access.c @@ -155,6 +155,33 @@ DYNAMIC_STRUCT_BEGIN(netlink_kernel_cfg) #endif DYNAMIC_STRUCT_END(netlink_kernel_cfg) + +#include +DYNAMIC_STRUCT_BEGIN(task_struct) + DEFINE_MEMBER(task_struct, pid) + DEFINE_MEMBER(task_struct, tgid) + DEFINE_MEMBER(task_struct, cred) + DEFINE_MEMBER(task_struct, real_cred) + DEFINE_MEMBER(task_struct, comm) + DEFINE_MEMBER(task_struct, parent) + DEFINE_MEMBER(task_struct, group_leader) + DEFINE_MEMBER(task_struct, mm) + DEFINE_MEMBER(task_struct, active_mm) + DEFINE_MEMBER(task_struct, thread_pid) + DEFINE_MEMBER(task_struct, files) + DEFINE_MEMBER(task_struct, seccomp) +#ifdef CONFIG_THREAD_INFO_IN_TASK + DEFINE_MEMBER(task_struct, thread_info) +#endif +#ifdef CONFIG_CGROUPS + DEFINE_MEMBER(task_struct, cgroups) +#endif +#ifdef CONFIG_SECURITY + DEFINE_MEMBER(task_struct, security) +#endif + DEFINE_MEMBER(task_struct, thread) +DYNAMIC_STRUCT_END(task_struct) + // ===================================================================================================================== #define STRUCT_INFO(name) &(name##_info) @@ -169,7 +196,8 @@ struct DynamicStructInfo* dynamic_struct_infos[] = { #endif STRUCT_INFO(vm_area_struct), STRUCT_INFO(vm_operations_struct), - STRUCT_INFO(netlink_kernel_cfg) + STRUCT_INFO(netlink_kernel_cfg), + STRUCT_INFO(task_struct) }; // return 0 if successful