Commit eddc0a3a authored by Eric W. Biederman's avatar Eric W. Biederman

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: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent 751c644b
...@@ -347,10 +347,8 @@ int yama_ptrace_traceme(struct task_struct *parent) ...@@ -347,10 +347,8 @@ int yama_ptrace_traceme(struct task_struct *parent)
/* Only disallow PTRACE_TRACEME on more aggressive settings. */ /* Only disallow PTRACE_TRACEME on more aggressive settings. */
switch (ptrace_scope) { switch (ptrace_scope) {
case YAMA_SCOPE_CAPABILITY: case YAMA_SCOPE_CAPABILITY:
rcu_read_lock(); if (!has_ns_capability(parent, current_user_ns(), CAP_SYS_PTRACE))
if (!ns_capable(__task_cred(parent)->user_ns, CAP_SYS_PTRACE))
rc = -EPERM; rc = -EPERM;
rcu_read_unlock();
break; break;
case YAMA_SCOPE_NO_ATTACH: case YAMA_SCOPE_NO_ATTACH:
rc = -EPERM; rc = -EPERM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment