diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-08-20 05:52:15 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-20 05:52:15 -0400 |
commit | 7393423dd9b5790a3115873be355e9fc862bce8f (patch) | |
tree | fc83214602c8ce41dc06d5c8e21deada679521f7 /security/commoncap.c | |
parent | 8df9676d6402563da91427e8d9f2da8a4598aede (diff) | |
parent | 1fca25427482387689fa27594c992a961d98768f (diff) |
Merge branch 'linus' into x86/cleanups
Diffstat (limited to 'security/commoncap.c')
-rw-r--r-- | security/commoncap.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/security/commoncap.c b/security/commoncap.c index 4afbece37a08..e4c4b3fc0c04 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -63,14 +63,24 @@ int cap_settime(struct timespec *ts, struct timezone *tz) | |||
63 | return 0; | 63 | return 0; |
64 | } | 64 | } |
65 | 65 | ||
66 | int cap_ptrace (struct task_struct *parent, struct task_struct *child, | 66 | int cap_ptrace_may_access(struct task_struct *child, unsigned int mode) |
67 | unsigned int mode) | ||
68 | { | 67 | { |
69 | /* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */ | 68 | /* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */ |
70 | if (!cap_issubset(child->cap_permitted, parent->cap_permitted) && | 69 | if (cap_issubset(child->cap_permitted, current->cap_permitted)) |
71 | !__capable(parent, CAP_SYS_PTRACE)) | 70 | return 0; |
72 | return -EPERM; | 71 | if (capable(CAP_SYS_PTRACE)) |
73 | return 0; | 72 | return 0; |
73 | return -EPERM; | ||
74 | } | ||
75 | |||
76 | int cap_ptrace_traceme(struct task_struct *parent) | ||
77 | { | ||
78 | /* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */ | ||
79 | if (cap_issubset(current->cap_permitted, parent->cap_permitted)) | ||
80 | return 0; | ||
81 | if (has_capability(parent, CAP_SYS_PTRACE)) | ||
82 | return 0; | ||
83 | return -EPERM; | ||
74 | } | 84 | } |
75 | 85 | ||
76 | int cap_capget (struct task_struct *target, kernel_cap_t *effective, | 86 | int cap_capget (struct task_struct *target, kernel_cap_t *effective, |
@@ -534,7 +544,7 @@ int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, | |||
534 | static inline int cap_safe_nice(struct task_struct *p) | 544 | static inline int cap_safe_nice(struct task_struct *p) |
535 | { | 545 | { |
536 | if (!cap_issubset(p->cap_permitted, current->cap_permitted) && | 546 | if (!cap_issubset(p->cap_permitted, current->cap_permitted) && |
537 | !__capable(current, CAP_SYS_NICE)) | 547 | !capable(CAP_SYS_NICE)) |
538 | return -EPERM; | 548 | return -EPERM; |
539 | return 0; | 549 | return 0; |
540 | } | 550 | } |