[PATCH v5 2/5] Smack: Prepare for PTRACE_MODE_SCHED

From
Jann Horn <jannh@google.com>
Date
2018-09-26 21:31:04
Also in
lkml, selinux
Reply to
Casey Schaufler, 2018-09-26
On Wed, Sep 26, 2018 at 10:35 PM Casey Schaufler
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
A ptrace access check with mode PTRACE_MODE_SCHED gets called
from process switching code. This precludes the use of audit,
as the locking is incompatible. Don't do audit in the PTRACE_MODE_SCHED
case.

Signed-off-by: Casey Schaufler <redacted>
---
 security/smack/smack_lsm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 340fc30ad85d..ffa95bcab599 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -422,7 +422,8 @@ static int smk_ptrace_rule_check(struct task_struct *tracer,
        struct task_smack *tsp;
        struct smack_known *tracer_known;

-       if ((mode & PTRACE_MODE_NOAUDIT) == 0) {
+       if ((mode & PTRACE_MODE_NOAUDIT) == 0 &&
+           (mode & PTRACE_MODE_SCHED) == 0) {
If you ORed PTRACE_MODE_NOAUDIT into the flags when calling the
security hook, you could drop this patch, right?
Thread (27 messages) 27 messages, 6 authors, last reply 2018-10-16
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help