Skip to content

Commit

Permalink
yama: Better permission check for ptraceme
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
  • Loading branch information
ebiederm committed Mar 26, 2013
1 parent 751c644 commit eddc0a3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions security/yama/yama_lsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,8 @@ int yama_ptrace_traceme(struct task_struct *parent)
/* Only disallow PTRACE_TRACEME on more aggressive settings. */
switch (ptrace_scope) {
case YAMA_SCOPE_CAPABILITY:
rcu_read_lock();
if (!ns_capable(__task_cred(parent)->user_ns, CAP_SYS_PTRACE))
if (!has_ns_capability(parent, current_user_ns(), CAP_SYS_PTRACE))
rc = -EPERM;
rcu_read_unlock();
break;
case YAMA_SCOPE_NO_ATTACH:
rc = -EPERM;
Expand Down

0 comments on commit eddc0a3

Please sign in to comment.