aboutsummaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorKees Cook <kees.cook@canonical.com>2010-07-13 09:04:08 -0700
committerLeann Ogasawara <leann.ogasawara@canonical.com>2010-08-11 07:42:28 -0700
commit3e30bcfa46d25d2be3875da680bbbeebabbd86aa (patch)
treec8be855c962aada879bbd4097e66f807ef3ec5b0 /security
parent4b45d8e2be4e1e786affd73a4e9379734c803d72 (diff)
UBUNTU: SAUCE: Yama: search for PTRACE exceptions via thread group leader
When looking for PTRACE exceptions, the thread group leader must be used otherwise the exceptions can be missed for threaded processes. BugLink: https://bugs.launchpad.net/bugs/603716 Signed-off-by: Kees Cook <kees.cook@canonical.com> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
Diffstat (limited to 'security')
-rw-r--r--security/yama/yama_lsm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c
index b28d9ccf25d..4a5bc1ad4b8 100644
--- a/security/yama/yama_lsm.c
+++ b/security/yama/yama_lsm.c
@@ -199,11 +199,19 @@ static int ptracer_exception_found(struct task_struct *tracer,
struct task_struct *parent = NULL;
spin_lock(&ptracer_relations_lock);
+
+ rcu_read_lock();
+ read_lock(&tasklist_lock);
+ if (!thread_group_leader(tracee))
+ tracee = tracee->group_leader;
list_for_each_entry(relation, &ptracer_relations, node)
if (relation->tracee == tracee) {
parent = relation->tracer;
break;
}
+ read_unlock(&tasklist_lock);
+ rcu_read_unlock();
+
if (task_is_descendant(parent, tracer))
rc = 1;
spin_unlock(&ptracer_relations_lock);