From 339e2b59d250e88faf6eedef58ad28f1e3ed8b1b Mon Sep 17 00:00:00 2001 From: Vyacheslav Cherkashin Date: Thu, 5 Dec 2013 18:44:25 +0400 Subject: [PATCH] [FIX] create sspt_proc struct only by group leader Change-Id: Ic432caf4e0c0969c126668781007574770a6c3ae Signed-off-by: Vyacheslav Cherkashin --- us_manager/helper.c | 3 +-- us_manager/pf/pf_group.c | 2 +- us_manager/sspt/sspt_proc.c | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/us_manager/helper.c b/us_manager/helper.c index 625edf2..7ee6c1e 100644 --- a/us_manager/helper.c +++ b/us_manager/helper.c @@ -58,10 +58,9 @@ static int entry_handler_mf(struct kretprobe_instance *ri, struct pt_regs *regs) /* Detects when IPs are really loaded into phy mem and installs probes. */ static int ret_handler_mf(struct kretprobe_instance *ri, struct pt_regs *regs) { - struct task_struct *task; + struct task_struct *task = current; unsigned long page_addr; - task = current->group_leader; if (is_kthread(task)) return 0; diff --git a/us_manager/pf/pf_group.c b/us_manager/pf/pf_group.c index fcab09c..4bd2c3e 100644 --- a/us_manager/pf/pf_group.c +++ b/us_manager/pf/pf_group.c @@ -227,7 +227,7 @@ void call_page_fault(struct task_struct *task, unsigned long page_addr) continue; proc = get_proc_by_pfg(pfg, task); - if (proc == NULL) { + if (proc == NULL && task->tgid == task->pid) { proc = new_proc_by_pfg(pfg, task); pfg_first = pfg; } diff --git a/us_manager/sspt/sspt_proc.c b/us_manager/sspt/sspt_proc.c index a0525a5..3fe2546 100644 --- a/us_manager/sspt/sspt_proc.c +++ b/us_manager/sspt/sspt_proc.c @@ -70,8 +70,8 @@ struct sspt_proc *sspt_proc_create(struct task_struct *task, void *priv) } INIT_LIST_HEAD(&proc->list); - proc->tgid = task ? task->tgid : 0; - proc->task = task; + proc->tgid = task->tgid; + proc->task = task->group_leader; proc->sm = create_sm_us(task); proc->first_install = 0; INIT_LIST_HEAD(&proc->file_list); -- 2.7.4