[PATCH 6/6] Yama: use thread group leader when creating match
Paolo Pisati
paolo.pisati at canonical.com
Thu Nov 24 10:07:26 UTC 2011
From: Kees Cook <kees.cook at canonical.com>
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 <kees.cook at canonical.com>
Acked-by: Tim Gardner <tim.gardner at canonical.com>
Acked-by: Stefan Bader <stefan.bader at canonical.com>
Signed-off-by: Stefan Bader <stefan.bader at canonical.com>
(cherry picked from commit ad0ff93928b5b690054ba8a8fa9cd37464733122)
BugLink: http://launchpad.net/bugs/893190
Signed-off-by: Paolo Pisati <paolo.pisati at canonical.com>
---
security/yama/yama_lsm.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c
index f3e7d7f..be177ca 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;
}
--
1.7.5.4
More information about the kernel-team
mailing list