提交 2cc8a716 编写于 作者: K Kees Cook 提交者: James Morris

Yama: replace capable() with ns_capable()

When checking capabilities, the question we want to be asking is "does
current() have the capability in the child's namespace?"
Signed-off-by: NKees Cook <keescook@chromium.org>
Signed-off-by: NJames Morris <james.l.morris@oracle.com>
上级 77b513dd
...@@ -264,11 +264,11 @@ static int yama_ptrace_access_check(struct task_struct *child, ...@@ -264,11 +264,11 @@ static int yama_ptrace_access_check(struct task_struct *child,
case YAMA_SCOPE_RELATIONAL: case YAMA_SCOPE_RELATIONAL:
if (!task_is_descendant(current, child) && if (!task_is_descendant(current, child) &&
!ptracer_exception_found(current, child) && !ptracer_exception_found(current, child) &&
!capable(CAP_SYS_PTRACE)) !ns_capable(task_user_ns(child), CAP_SYS_PTRACE))
rc = -EPERM; rc = -EPERM;
break; break;
case YAMA_SCOPE_CAPABILITY: case YAMA_SCOPE_CAPABILITY:
if (!capable(CAP_SYS_PTRACE)) if (!ns_capable(task_user_ns(child), CAP_SYS_PTRACE))
rc = -EPERM; rc = -EPERM;
break; break;
case YAMA_SCOPE_NO_ATTACH: case YAMA_SCOPE_NO_ATTACH:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册