summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-02-28 05:29:16 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-02-28 05:29:16 -0300
commit844e3cded9c8665e95b1e43b707a6c3adcbc901f (patch)
treedd9cccb325c949319a9de3e0cabad91d6261fa75 /security
parent6d461a4fe7896faa1aec5a5417888cf179e46b9f (diff)
Linux-libre 4.4.3-gnu
Diffstat (limited to 'security')
-rw-r--r--security/commoncap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/security/commoncap.c b/security/commoncap.c
index 987ff5f8f..bf8241483 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -137,12 +137,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;