diff options
author | Jonathan Corbet <corbet@lwn.net> | 2008-07-14 17:29:34 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2008-07-14 17:29:34 -0400 |
commit | 2fceef397f9880b212a74c418290ce69e7ac00eb (patch) | |
tree | d9cc09ab992825ef7fede4a688103503e3caf655 /security/commoncap.c | |
parent | feae1ef116ed381625d3731c5ae4f4ebcb3fa302 (diff) | |
parent | bce7f793daec3e65ec5c5705d2457b81fe7b5725 (diff) |
Merge commit 'v2.6.26' into bkl-removal
Diffstat (limited to 'security/commoncap.c')
-rw-r--r-- | security/commoncap.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/security/commoncap.c b/security/commoncap.c index 5edabc7542ae..33d343308413 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -103,10 +103,16 @@ static inline int cap_inh_is_capped(void) | |||
103 | return (cap_capable(current, CAP_SETPCAP) != 0); | 103 | return (cap_capable(current, CAP_SETPCAP) != 0); |
104 | } | 104 | } |
105 | 105 | ||
106 | static inline int cap_limit_ptraced_target(void) { return 1; } | ||
107 | |||
106 | #else /* ie., ndef CONFIG_SECURITY_FILE_CAPABILITIES */ | 108 | #else /* ie., ndef CONFIG_SECURITY_FILE_CAPABILITIES */ |
107 | 109 | ||
108 | static inline int cap_block_setpcap(struct task_struct *t) { return 0; } | 110 | static inline int cap_block_setpcap(struct task_struct *t) { return 0; } |
109 | static inline int cap_inh_is_capped(void) { return 1; } | 111 | static inline int cap_inh_is_capped(void) { return 1; } |
112 | static inline int cap_limit_ptraced_target(void) | ||
113 | { | ||
114 | return !capable(CAP_SETPCAP); | ||
115 | } | ||
110 | 116 | ||
111 | #endif /* def CONFIG_SECURITY_FILE_CAPABILITIES */ | 117 | #endif /* def CONFIG_SECURITY_FILE_CAPABILITIES */ |
112 | 118 | ||
@@ -342,9 +348,10 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe) | |||
342 | bprm->e_uid = current->uid; | 348 | bprm->e_uid = current->uid; |
343 | bprm->e_gid = current->gid; | 349 | bprm->e_gid = current->gid; |
344 | } | 350 | } |
345 | if (!capable (CAP_SETPCAP)) { | 351 | if (cap_limit_ptraced_target()) { |
346 | new_permitted = cap_intersect (new_permitted, | 352 | new_permitted = |
347 | current->cap_permitted); | 353 | cap_intersect(new_permitted, |
354 | current->cap_permitted); | ||
348 | } | 355 | } |
349 | } | 356 | } |
350 | } | 357 | } |