Skip to content

Commit eddc0a3

Browse files
committed
yama: Better permission check for ptraceme
Change the permission check for yama_ptrace_ptracee to the standard ptrace permission check, testing if the traceer has CAP_SYS_PTRACE in the tracees user namespace. Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
1 parent 751c644 commit eddc0a3

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

‎security/yama/yama_lsm.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,8 @@ int yama_ptrace_traceme(struct task_struct *parent)
347347
/* Only disallow PTRACE_TRACEME on more aggressive settings. */
348348
switch (ptrace_scope) {
349349
case YAMA_SCOPE_CAPABILITY:
350-
rcu_read_lock();
351-
if (!ns_capable(__task_cred(parent)->user_ns, CAP_SYS_PTRACE))
350+
if (!has_ns_capability(parent, current_user_ns(), CAP_SYS_PTRACE))
352351
rc = -EPERM;
353-
rcu_read_unlock();
354352
break;
355353
case YAMA_SCOPE_NO_ATTACH:
356354
rc = -EPERM;

0 commit comments

Comments
 (0)