diff --git a/source/module/monitor_kallsyms.c b/source/module/monitor_kallsyms.c index 412088f..9517b9b 100644 --- a/source/module/monitor_kallsyms.c +++ b/source/module/monitor_kallsyms.c @@ -19,9 +19,6 @@ int (*orig_access_remote_vm)(struct mm_struct *mm, unsigned long addr, struct task_struct *(*orig_find_task_by_vpid)(pid_t nr); -/// @brief init kallsyms_lookup_name,all orig_fun are depend on it -/// @param -/// @return 0 is success static int fn_kallsyms_lookup_name_init(void) { register_kprobe(&kprobe_kallsyms_lookup_name); diag_kallsyms_lookup_name = (void *)kprobe_kallsyms_lookup_name.addr; @@ -41,22 +38,21 @@ static int fn_kallsyms_lookup_name_init(void) { * @return int 0 is success */ int init_orig_fun(void) { - int ret = fn_kallsyms_lookup_name_init(); // init kallsyms_lookup_name + int ret = fn_kallsyms_lookup_name_init(); // init kallsyms_lookup_name - if (ret) - { + if (ret) { printk(KERN_INFO "init kallsyms_lookup_name failed\n"); return ret; } - LOOKUP_SYMS(stack_trace_save_tsk); // stack_trace_save_tsk - LOOKUP_SYMS(show_stack); // show_stack - LOOKUP_SYMS(idle_sched_class); // idle_sched_class - LOOKUP_SYMS(access_remote_vm); // access_remote_vm + LOOKUP_SYMS(stack_trace_save_tsk); // stack_trace_save_tsk + LOOKUP_SYMS(show_stack); // show_stack + LOOKUP_SYMS(idle_sched_class); // idle_sched_class + LOOKUP_SYMS(access_remote_vm); // access_remote_vm 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 + 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 9df89f0..c77e7bd 100644 --- a/source/module/monitor_kallsyms.h +++ b/source/module/monitor_kallsyms.h @@ -34,12 +34,13 @@ extern unsigned int (*orig_stack_trace_save_tsk)(struct task_struct *task, unsigned int size, unsigned int skipnr); extern void (*orig_show_stack)(struct task_struct *task, unsigned long *sp, - const char *loglvl); - -extern struct sched_class *orig_idle_sched_class; + const char *loglvl); // output kernel stack +extern struct sched_class *orig_idle_sched_class; // idle process 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); -extern struct task_struct *(*orig_find_task_by_vpid)(pid_t nr); \ No newline at end of file + size_t buflen); // get sysfs name +extern int (*orig_access_remote_vm)( + struct mm_struct *mm, unsigned long addr, void *buf, int len, + unsigned int gup_flags); // read remote memory +extern struct task_struct *(*orig_find_task_by_vpid)( + pid_t nr); // find task by pid \ No newline at end of file