X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=security%2Fcommoncap.c;h=7fa251aea32f88d3bd50be9d06b890991d1eec9e;hb=94e602741d994939a0bbade67950dcac887e9dff;hp=f035b84b3601a4d13b8e30a16396d5a85ab88a95;hpb=fbcc24698c3040c28f358bc7ffb669290309d63f;p=firefly-linux-kernel-4.4.55.git diff --git a/security/commoncap.c b/security/commoncap.c index f035b84b3601..7fa251aea32f 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -148,12 +148,17 @@ int cap_ptrace_access_check(struct task_struct *child, unsigned int mode) { int ret = 0; const struct cred *cred, *child_cred; + const kernel_cap_t *caller_caps; rcu_read_lock(); cred = current_cred(); child_cred = __task_cred(child); + if (mode & PTRACE_MODE_FSCREDS) + caller_caps = &cred->cap_effective; + else + caller_caps = &cred->cap_permitted; if (cred->user_ns == child_cred->user_ns && - cap_issubset(child_cred->cap_permitted, cred->cap_permitted)) + cap_issubset(child_cred->cap_permitted, *caller_caps)) goto out; if (ns_capable(child_cred->user_ns, CAP_SYS_PTRACE)) goto out;