aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/capability.h
diff options
context:
space:
mode:
authorSerge E. Hallyn <serge@hallyn.com>2011-03-23 19:43:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-23 22:47:05 -0400
commit8409cca7056113bee3236cb6a8e4d8d4d1eef102 (patch)
treed9f1ced0d47070fcdf8b399021f33770c150b1ec /include/linux/capability.h
parent39fd33933b0209e4b6254743f2cede07c5ad4c52 (diff)
userns: allow ptrace from non-init user namespaces
ptrace is allowed to tasks in the same user namespace according to the usual rules (i.e. the same rules as for two tasks in the init user namespace). ptrace is also allowed to a user namespace to which the current task the has CAP_SYS_PTRACE capability. Changelog: Dec 31: Address feedback by Eric: . Correct ptrace uid check . Rename may_ptrace_ns to ptrace_capable . Also fix the cap_ptrace checks. Jan 1: Use const cred struct Jan 11: use task_ns_capable() in place of ptrace_capable(). Feb 23: same_or_ancestore_user_ns() was not an appropriate check to constrain cap_issubset. Rather, cap_issubset() only is meaningful when both capsets are in the same user_ns. Signed-off-by: Serge E. Hallyn <serge.hallyn@canonical.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Daniel Lezcano <daniel.lezcano@free.fr> Acked-by: David Howells <dhowells@redhat.com> Cc: James Morris <jmorris@namei.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/capability.h')
-rw-r--r--include/linux/capability.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 7c9c82903012..2ec4a8cc86a5 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -553,6 +553,8 @@ static inline kernel_cap_t cap_raise_nfsd_set(const kernel_cap_t a,
553 */ 553 */
554#define has_capability(t, cap) (security_real_capable((t), &init_user_ns, (cap)) == 0) 554#define has_capability(t, cap) (security_real_capable((t), &init_user_ns, (cap)) == 0)
555 555
556#define has_ns_capability(t, ns, cap) (security_real_capable((t), (ns), (cap)) == 0)
557
556/** 558/**
557 * has_capability_noaudit - Determine if a task has a superior capability available (unaudited) 559 * has_capability_noaudit - Determine if a task has a superior capability available (unaudited)
558 * @t: The task in question 560 * @t: The task in question