From 1ba029a6b843b11bb1106d263ff2df8a7c98ed14 Mon Sep 17 00:00:00 2001 From: zy Date: Wed, 22 Nov 2023 22:53:42 -0500 Subject: [PATCH] orig_find_task_by_vpid --- source/module/monitor_kallsyms.c | 3 +++ source/module/monitor_kallsyms.h | 3 ++- source/module/monitor_trace.h | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/source/module/monitor_kallsyms.c b/source/module/monitor_kallsyms.c index ae2ea95..412088f 100644 --- a/source/module/monitor_kallsyms.c +++ b/source/module/monitor_kallsyms.c @@ -16,6 +16,8 @@ int (*orig_get_task_type)(struct sched_entity *se); int (*orig_kernfs_name)(struct kernfs_node *kn, char *buf, size_t buflen); int (*orig_access_remote_vm)(struct mm_struct *mm, unsigned long addr, void *buf, int len, unsigned int gup_flags); +struct task_struct *(*orig_find_task_by_vpid)(pid_t nr); + /// @brief init kallsyms_lookup_name,all orig_fun are depend on it /// @param @@ -55,5 +57,6 @@ int init_orig_fun(void) { LOOKUP_SYMS_NORET( get_task_type); // get_task_type | this fun is not available on 5.17.15 LOOKUP_SYMS_NORET(kernfs_name); // kernfs_name + LOOKUP_SYMS_NORET(find_task_by_vpid); return 0; } diff --git a/source/module/monitor_kallsyms.h b/source/module/monitor_kallsyms.h index d127e4a..9df89f0 100644 --- a/source/module/monitor_kallsyms.h +++ b/source/module/monitor_kallsyms.h @@ -41,4 +41,5 @@ extern int (*orig_get_task_type)(struct sched_entity *se); extern int (*orig_kernfs_name)(struct kernfs_node *kn, char *buf, size_t buflen); extern int (*orig_access_remote_vm)(struct mm_struct *mm, unsigned long addr, - void *buf, int len, unsigned int gup_flags); \ No newline at end of file + void *buf, int len, unsigned int gup_flags); +extern struct task_struct *(*orig_find_task_by_vpid)(pid_t nr); \ No newline at end of file diff --git a/source/module/monitor_trace.h b/source/module/monitor_trace.h index 6ff3abf..1938862 100644 --- a/source/module/monitor_trace.h +++ b/source/module/monitor_trace.h @@ -113,6 +113,8 @@ void dump_proc_chains_argv( int style, struct task_struct *tsk, mm_tree *mm_tree, proc_chains_detail *detail); // get process chains argv +void diag_test(int nid); // for test + // print // void diag_printf_kern_stack(kern_stack_detail *kern_stack); // void diag_printf_kern_stack(kern_stack_detail *kern_stack, int reverse); @@ -128,3 +130,4 @@ extern unsigned int (*orig_stack_trace_save_tsk)(struct task_struct *task, unsigned long *store, unsigned int size, unsigned int skipnr); +extern struct task_struct *(*orig_find_task_by_vpid)(pid_t nr);