diff options
Diffstat (limited to 'security')
-rw-r--r-- | security/commoncap.c | 3 | ||||
-rw-r--r-- | security/dummy.c | 3 | ||||
-rw-r--r-- | security/security.c | 5 | ||||
-rw-r--r-- | security/selinux/hooks.c | 13 | ||||
-rw-r--r-- | security/smack/smack_lsm.c | 5 |
5 files changed, 21 insertions, 8 deletions
diff --git a/security/commoncap.c b/security/commoncap.c index 33d343308413..0b6537a3672d 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -63,7 +63,8 @@ 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 (struct task_struct *parent, struct task_struct *child, |
67 | unsigned int mode) | ||
67 | { | 68 | { |
68 | /* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */ | 69 | /* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */ |
69 | if (!cap_issubset(child->cap_permitted, parent->cap_permitted) && | 70 | if (!cap_issubset(child->cap_permitted, parent->cap_permitted) && |
diff --git a/security/dummy.c b/security/dummy.c index b8916883b77f..1db712d99dc7 100644 --- a/security/dummy.c +++ b/security/dummy.c | |||
@@ -30,7 +30,8 @@ | |||
30 | #include <linux/prctl.h> | 30 | #include <linux/prctl.h> |
31 | #include <linux/securebits.h> | 31 | #include <linux/securebits.h> |
32 | 32 | ||
33 | static int dummy_ptrace (struct task_struct *parent, struct task_struct *child) | 33 | static int dummy_ptrace (struct task_struct *parent, struct task_struct *child, |
34 | unsigned int mode) | ||
34 | { | 35 | { |
35 | return 0; | 36 | return 0; |
36 | } | 37 | } |
diff --git a/security/security.c b/security/security.c index 59838a99b80e..c4507ce2a5a0 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -161,9 +161,10 @@ int mod_reg_security(const char *name, struct security_operations *ops) | |||
161 | 161 | ||
162 | /* Security operations */ | 162 | /* Security operations */ |
163 | 163 | ||
164 | int security_ptrace(struct task_struct *parent, struct task_struct *child) | 164 | int security_ptrace(struct task_struct *parent, struct task_struct *child, |
165 | unsigned int mode) | ||
165 | { | 166 | { |
166 | return security_ops->ptrace(parent, child); | 167 | return security_ops->ptrace(parent, child, mode); |
167 | } | 168 | } |
168 | 169 | ||
169 | int security_capget(struct task_struct *target, | 170 | int security_capget(struct task_struct *target, |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index eca70f42e678..4be156334b22 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1686,14 +1686,23 @@ static inline u32 file_to_av(struct file *file) | |||
1686 | 1686 | ||
1687 | /* Hook functions begin here. */ | 1687 | /* Hook functions begin here. */ |
1688 | 1688 | ||
1689 | static int selinux_ptrace(struct task_struct *parent, struct task_struct *child) | 1689 | static int selinux_ptrace(struct task_struct *parent, |
1690 | struct task_struct *child, | ||
1691 | unsigned int mode) | ||
1690 | { | 1692 | { |
1691 | int rc; | 1693 | int rc; |
1692 | 1694 | ||
1693 | rc = secondary_ops->ptrace(parent, child); | 1695 | rc = secondary_ops->ptrace(parent, child, mode); |
1694 | if (rc) | 1696 | if (rc) |
1695 | return rc; | 1697 | return rc; |
1696 | 1698 | ||
1699 | if (mode == PTRACE_MODE_READ) { | ||
1700 | struct task_security_struct *tsec = parent->security; | ||
1701 | struct task_security_struct *csec = child->security; | ||
1702 | return avc_has_perm(tsec->sid, csec->sid, | ||
1703 | SECCLASS_FILE, FILE__READ, NULL); | ||
1704 | } | ||
1705 | |||
1697 | return task_has_perm(parent, child, PROCESS__PTRACE); | 1706 | return task_has_perm(parent, child, PROCESS__PTRACE); |
1698 | } | 1707 | } |
1699 | 1708 | ||
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 4a09293efa00..3c7150b3493d 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -95,11 +95,12 @@ struct inode_smack *new_inode_smack(char *smack) | |||
95 | * | 95 | * |
96 | * Do the capability checks, and require read and write. | 96 | * Do the capability checks, and require read and write. |
97 | */ | 97 | */ |
98 | static int smack_ptrace(struct task_struct *ptp, struct task_struct *ctp) | 98 | static int smack_ptrace(struct task_struct *ptp, struct task_struct *ctp, |
99 | unsigned int mode) | ||
99 | { | 100 | { |
100 | int rc; | 101 | int rc; |
101 | 102 | ||
102 | rc = cap_ptrace(ptp, ctp); | 103 | rc = cap_ptrace(ptp, ctp, mode); |
103 | if (rc != 0) | 104 | if (rc != 0) |
104 | return rc; | 105 | return rc; |
105 | 106 | ||