Skip to content

Commit

Permalink
Yama: replace capable() with ns_capable()
Browse files Browse the repository at this point in the history
When checking capabilities, the question we want to be asking is "does
current() have the capability in the child's namespace?"

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: James Morris <james.l.morris@oracle.com>
  • Loading branch information
kees authored and James Morris committed May 15, 2012
1 parent 77b513d commit 2cc8a71
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions security/yama/yama_lsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ static int yama_ptrace_access_check(struct task_struct *child,
case YAMA_SCOPE_RELATIONAL:
if (!task_is_descendant(current, child) &&
!ptracer_exception_found(current, child) &&
!capable(CAP_SYS_PTRACE))
!ns_capable(task_user_ns(child), CAP_SYS_PTRACE))
rc = -EPERM;
break;
case YAMA_SCOPE_CAPABILITY:
if (!capable(CAP_SYS_PTRACE))
if (!ns_capable(task_user_ns(child), CAP_SYS_PTRACE))
rc = -EPERM;
break;
case YAMA_SCOPE_NO_ATTACH:
Expand Down

0 comments on commit 2cc8a71

Please sign in to comment.