From: Stephen Smalley Date: Sat, 11 Mar 2006 11:27:16 +0000 (-0800) Subject: [PATCH] selinux: tracer SID fix X-Git-Tag: v2.6.16-rc6~22 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=341c2d806b71cc3596afeb2d9bd26cd718e75202;p=linux-2.6 [PATCH] selinux: tracer SID fix Fix SELinux to not reset the tracer SID when the child is already being traced, since selinux_ptrace is also called by proc for access checking outside of the context of a ptrace attach. Signed-off-by: Stephen Smalley Acked-by: James Morris Acked-by: Chris Wright Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index b7773bf68e..b65c201e9f 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -1262,7 +1262,7 @@ static int selinux_ptrace(struct task_struct *parent, struct task_struct *child) rc = task_has_perm(parent, child, PROCESS__PTRACE); /* Save the SID of the tracing process for later use in apply_creds. */ - if (!rc) + if (!(child->ptrace & PT_PTRACED) && !rc) csec->ptrace_sid = psec->sid; return rc; }