code clean1

This commit is contained in:
zy
2023-11-27 01:42:45 -05:00
parent 28c67943e3
commit a04078c068
2 changed files with 16 additions and 19 deletions

View File

@@ -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;
}

View File

@@ -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);
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