Skip to content

Commit 338d0be

Browse files
committed
apparmor: fix ptrace read check
The ptrace read check is incorrect resulting in policy that is broader than it needs to be. Fix the check so that read access permission can be properly detected when other ptrace flags are set. Fixes: b2d09ae ("apparmor: move ptrace checks to using labels") Signed-off-by: John Johansen <[email protected]>
1 parent 3ddae98 commit 338d0be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

security/apparmor/lsm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ static int apparmor_ptrace_access_check(struct task_struct *child,
117117
tracer = begin_current_label_crit_section();
118118
tracee = aa_get_task_label(child);
119119
error = aa_may_ptrace(tracer, tracee,
120-
mode == PTRACE_MODE_READ ? AA_PTRACE_READ : AA_PTRACE_TRACE);
120+
(mode & PTRACE_MODE_READ) ? AA_PTRACE_READ
121+
: AA_PTRACE_TRACE);
121122
aa_put_label(tracee);
122123
end_current_label_crit_section(tracer);
123124

0 commit comments

Comments
 (0)