projects/linux·commit 341c2d80

[PATCH] selinux: tracer SID fix

341c2d80 · Stephen Smalley <[email protected]> · 2006-03-11 03:27:16 -08:00

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 <[email protected]>
Acked-by: James Morris <[email protected]>
Acked-by: Chris Wright <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
341c2d806b71cc3596afeb2d9bd26cd718e75202
Parents
4136cabf

Changes

1 files changed · +1 −1

FileStatusAddDelContent
security/selinux/hooks.cmodified+1−1View file

security/selinux/hooks.c

View file
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index b7773bf..b65c201 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;
}