summaryrefslogtreecommitdiff
path: root/security/commoncap.c
diff options
context:
space:
mode:
authorSumit Semwal <sumit.semwal@linaro.org>2016-05-17 15:10:09 +0000
committerSumit Semwal <sumit.semwal@linaro.org>2016-05-17 15:10:09 +0000
commit99e17f8a0421fd1958bdee92e7e66c22b89d9556 (patch)
tree15cacceadb018151ac80cd34c786cef5818d614d /security/commoncap.c
parent914edc40eafa0dabf561bf29c8e768a4b636e7f5 (diff)
parent08e85b5fa9b0d262c8d69709088ec7fbbab2ad28 (diff)
Merge branch 'android-hikey-linaro-4.4' of https://android.googlesource.com/kernel/hikey-linaro into clang-4.4android-hikey-linaro-4.4-clang
Diffstat (limited to 'security/commoncap.c')
-rw-r--r--security/commoncap.c7
1 files changed, 6 insertions, 1 deletions
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;