diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-09-14 12:24:00 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-14 12:24:00 -0400 |
commit | 83bd6998b04fc1bb7280b14f16b2bdbdc07c914b (patch) | |
tree | af1bbe2bac5752b69b1ac58bf5d822c735da439b /security/selinux/hooks.c | |
parent | e7250b8ae3870f37f660c2f65cafcaba85e3bfd3 (diff) | |
parent | adee14b2e1557d0a8559f29681732d05a89dfc35 (diff) |
Merge commit 'v2.6.27-rc6' into timers/hpet
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 40d06c533f89..03fc6a81ae32 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -998,8 +998,12 @@ static int selinux_sb_show_options(struct seq_file *m, struct super_block *sb) | |||
998 | int rc; | 998 | int rc; |
999 | 999 | ||
1000 | rc = selinux_get_mnt_opts(sb, &opts); | 1000 | rc = selinux_get_mnt_opts(sb, &opts); |
1001 | if (rc) | 1001 | if (rc) { |
1002 | /* before policy load we may get EINVAL, don't show anything */ | ||
1003 | if (rc == -EINVAL) | ||
1004 | rc = 0; | ||
1002 | return rc; | 1005 | return rc; |
1006 | } | ||
1003 | 1007 | ||
1004 | selinux_write_opts(m, &opts); | 1008 | selinux_write_opts(m, &opts); |
1005 | 1009 | ||
@@ -1734,24 +1738,34 @@ static inline u32 file_to_av(struct file *file) | |||
1734 | 1738 | ||
1735 | /* Hook functions begin here. */ | 1739 | /* Hook functions begin here. */ |
1736 | 1740 | ||
1737 | static int selinux_ptrace(struct task_struct *parent, | 1741 | static int selinux_ptrace_may_access(struct task_struct *child, |
1738 | struct task_struct *child, | 1742 | unsigned int mode) |
1739 | unsigned int mode) | ||
1740 | { | 1743 | { |
1741 | int rc; | 1744 | int rc; |
1742 | 1745 | ||
1743 | rc = secondary_ops->ptrace(parent, child, mode); | 1746 | rc = secondary_ops->ptrace_may_access(child, mode); |
1744 | if (rc) | 1747 | if (rc) |
1745 | return rc; | 1748 | return rc; |
1746 | 1749 | ||
1747 | if (mode == PTRACE_MODE_READ) { | 1750 | if (mode == PTRACE_MODE_READ) { |
1748 | struct task_security_struct *tsec = parent->security; | 1751 | struct task_security_struct *tsec = current->security; |
1749 | struct task_security_struct *csec = child->security; | 1752 | struct task_security_struct *csec = child->security; |
1750 | return avc_has_perm(tsec->sid, csec->sid, | 1753 | return avc_has_perm(tsec->sid, csec->sid, |
1751 | SECCLASS_FILE, FILE__READ, NULL); | 1754 | SECCLASS_FILE, FILE__READ, NULL); |
1752 | } | 1755 | } |
1753 | 1756 | ||
1754 | return task_has_perm(parent, child, PROCESS__PTRACE); | 1757 | return task_has_perm(current, child, PROCESS__PTRACE); |
1758 | } | ||
1759 | |||
1760 | static int selinux_ptrace_traceme(struct task_struct *parent) | ||
1761 | { | ||
1762 | int rc; | ||
1763 | |||
1764 | rc = secondary_ops->ptrace_traceme(parent); | ||
1765 | if (rc) | ||
1766 | return rc; | ||
1767 | |||
1768 | return task_has_perm(parent, current, PROCESS__PTRACE); | ||
1755 | } | 1769 | } |
1756 | 1770 | ||
1757 | static int selinux_capget(struct task_struct *target, kernel_cap_t *effective, | 1771 | static int selinux_capget(struct task_struct *target, kernel_cap_t *effective, |
@@ -5342,7 +5356,8 @@ static int selinux_key_getsecurity(struct key *key, char **_buffer) | |||
5342 | static struct security_operations selinux_ops = { | 5356 | static struct security_operations selinux_ops = { |
5343 | .name = "selinux", | 5357 | .name = "selinux", |
5344 | 5358 | ||
5345 | .ptrace = selinux_ptrace, | 5359 | .ptrace_may_access = selinux_ptrace_may_access, |
5360 | .ptrace_traceme = selinux_ptrace_traceme, | ||
5346 | .capget = selinux_capget, | 5361 | .capget = selinux_capget, |
5347 | .capset_check = selinux_capset_check, | 5362 | .capset_check = selinux_capset_check, |
5348 | .capset_set = selinux_capset_set, | 5363 | .capset_set = selinux_capset_set, |