From 46741f66208cd1e5e3cf4c001618ba7924a92d1a Mon Sep 17 00:00:00 2001 From: Vyacheslav Cherkashin Date: Mon, 6 May 2013 08:30:30 +0400 Subject: [PATCH] [REFACTOR] remove copy_process_ret_pre_code() move functional from copy_process_ret_pre_code() to ret_handler_cp() --- driver/us_proc_inst.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/driver/us_proc_inst.c b/driver/us_proc_inst.c index e6b1f3c..0116a9a 100644 --- a/driver/us_proc_inst.c +++ b/driver/us_proc_inst.c @@ -167,14 +167,20 @@ static struct kretprobe pf_kretprobe = { .data_size = sizeof(struct pf_data) }; -static void copy_process_ret_pre_code(struct task_struct *p); +static void rm_uprobes_child(struct task_struct *task); +/* Delete uprobs in children at fork */ static int ret_handler_cp(struct kretprobe_instance *ri, struct pt_regs *regs) { struct task_struct* task = (struct task_struct *)regs_return_value(regs); - copy_process_ret_pre_code(task); + if(!task || IS_ERR(task)) + goto out; + + if(task->mm != current->mm) /* check flags CLONE_VM */ + rm_uprobes_child(task); +out: return 0; } @@ -1078,30 +1084,20 @@ static void recover_child(struct task_struct *child_task, struct sspt_procs *pro dbi_disarm_urp_inst_for_task(current, child_task); } -static void rm_uprobes_child(struct task_struct *new_task) +static void rm_uprobes_child(struct task_struct *task) { if (is_libonly()) { struct sspt_procs *procs = get_proc_probes_by_task(current); if(procs) { - recover_child(new_task, procs); + recover_child(task, procs); } } else { if(us_proc_info.tgid == current->tgid) { - recover_child(new_task, us_proc_info.pp); + recover_child(task, us_proc_info.pp); } } } -/* Delete uprobs in children at fork */ -static void copy_process_ret_pre_code(struct task_struct *p) -{ - if(!p || IS_ERR(p)) - return; - - if(p->mm != current->mm) // check flags CLONE_VM - rm_uprobes_child(p); -} - static DEFINE_PER_CPU(struct us_ip *, gpCurIp) = NULL; EXPORT_PER_CPU_SYMBOL_GPL(gpCurIp); static DEFINE_PER_CPU(struct pt_regs *, gpUserRegs) = NULL; -- 2.7.4