From: Kees Cook Date: Tue, 8 Mar 2011 02:36:03 +0000 (-0800) Subject: Yama: use thread group leader when creating match X-Git-Url: http://git.alex.org.uk Yama: use thread group leader when creating match Like the earlier bug-fix for thread group leader when matching, we also need to find the thread group leader for "current" when creating the match. BugLink: http://bugs.launchpad.net/bugs/729839 Signed-off-by: Kees Cook Signed-off-by: Tim Gardner --- diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c index a1aed186..f082a55 100644 --- a/security/yama/yama_lsm.c +++ b/security/yama/yama_lsm.c @@ -131,8 +131,12 @@ int yama_task_prctl(int option, unsigned long arg2, unsigned long arg3, } else { struct task_struct *tracer; + struct task_struct *myself = current; rcu_read_lock(); + if (!thread_group_leader(myself)) + myself = myself->group_leader; + get_task_struct(myself); tracer = find_task_by_vpid(arg2); if (tracer) get_task_struct(tracer); @@ -141,9 +145,10 @@ int yama_task_prctl(int option, unsigned long arg2, unsigned long arg3, rcu_read_unlock(); if (tracer) { - rc = yama_ptracer_add(tracer, current); + rc = yama_ptracer_add(tracer, myself); put_task_struct(tracer); } + put_task_struct(myself); } break; }