X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=security%2Fcommoncap.c;h=7790e4841642c2100a6c10b70f38b120604ee780;hp=f90d82f128ccbc859e3ae2a97f774e6188435165;hb=94b798ff0d7d4c30e38f9b61fc29fd17472221f9;hpb=79b925fd67c0de25ef07ee46f9bd82e2ee44dd54 diff --git a/security/commoncap.c b/security/commoncap.c index f90d82f128cc..7790e4841642 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -141,12 +141,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->user_ns == child_cred->user->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->user_ns, CAP_SYS_PTRACE)) goto out;