diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-05 12:44:57 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-05 12:44:57 -0500 |
| commit | 83fdbfbfe6e7e8906e3a3f8f6bc074d887e92109 (patch) | |
| tree | 977e10a076d76fdb2622f089211f3d0954ba6873 /security/selinux/hooks.c | |
| parent | d9b2c4d0b03c721808c0d259e43a27f1e80205bc (diff) | |
| parent | c84d6efd363a3948eb32ec40d46bab6338580454 (diff) | |
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: (30 commits)
TOMOYO: Add recursive directory matching operator support.
remove CONFIG_SECURITY_FILE_CAPABILITIES compile option
SELinux: print denials for buggy kernel with unknown perms
Silence the existing API for capability version compatibility check.
LSM: Move security_path_chmod()/security_path_chown() to after mutex_lock().
SELinux: header generation may hit infinite loop
selinux: Fix warnings
security: report the module name to security_module_request
Config option to set a default LSM
sysctl: require CAP_SYS_RAWIO to set mmap_min_addr
tpm: autoload tpm_tis based on system PnP IDs
tpm_tis: TPM_STS_DATA_EXPECT workaround
define convenient securebits masks for prctl users (v2)
tpm: fix header for modular build
tomoyo: improve hash bucket dispersion
tpm add default function definitions
LSM: imbed ima calls in the security hooks
SELinux: add .gitignore files for dynamic classes
security: remove root_plug
SELinux: fix locking issue introduced with c6d3aaa4e35c71a3
...
Diffstat (limited to 'security/selinux/hooks.c')
| -rw-r--r-- | security/selinux/hooks.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index bb230d5d7085..c96d63ec4753 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
| @@ -91,7 +91,6 @@ | |||
| 91 | 91 | ||
| 92 | #define NUM_SEL_MNT_OPTS 5 | 92 | #define NUM_SEL_MNT_OPTS 5 |
| 93 | 93 | ||
| 94 | extern unsigned int policydb_loaded_version; | ||
| 95 | extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm); | 94 | extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm); |
| 96 | extern struct security_operations *security_ops; | 95 | extern struct security_operations *security_ops; |
| 97 | 96 | ||
| @@ -3338,9 +3337,18 @@ static int selinux_kernel_create_files_as(struct cred *new, struct inode *inode) | |||
| 3338 | return 0; | 3337 | return 0; |
| 3339 | } | 3338 | } |
| 3340 | 3339 | ||
| 3341 | static int selinux_kernel_module_request(void) | 3340 | static int selinux_kernel_module_request(char *kmod_name) |
| 3342 | { | 3341 | { |
| 3343 | return task_has_system(current, SYSTEM__MODULE_REQUEST); | 3342 | u32 sid; |
| 3343 | struct common_audit_data ad; | ||
| 3344 | |||
| 3345 | sid = task_sid(current); | ||
| 3346 | |||
| 3347 | COMMON_AUDIT_DATA_INIT(&ad, KMOD); | ||
| 3348 | ad.u.kmod_name = kmod_name; | ||
| 3349 | |||
| 3350 | return avc_has_perm(sid, SECINITSID_KERNEL, SECCLASS_SYSTEM, | ||
| 3351 | SYSTEM__MODULE_REQUEST, &ad); | ||
| 3344 | } | 3352 | } |
| 3345 | 3353 | ||
| 3346 | static int selinux_task_setpgid(struct task_struct *p, pid_t pgid) | 3354 | static int selinux_task_setpgid(struct task_struct *p, pid_t pgid) |
| @@ -4714,10 +4722,7 @@ static int selinux_netlink_send(struct sock *sk, struct sk_buff *skb) | |||
| 4714 | if (err) | 4722 | if (err) |
| 4715 | return err; | 4723 | return err; |
| 4716 | 4724 | ||
| 4717 | if (policydb_loaded_version >= POLICYDB_VERSION_NLCLASS) | 4725 | return selinux_nlmsg_perm(sk, skb); |
| 4718 | err = selinux_nlmsg_perm(sk, skb); | ||
| 4719 | |||
| 4720 | return err; | ||
| 4721 | } | 4726 | } |
| 4722 | 4727 | ||
| 4723 | static int selinux_netlink_recv(struct sk_buff *skb, int capability) | 4728 | static int selinux_netlink_recv(struct sk_buff *skb, int capability) |
| @@ -5830,12 +5835,12 @@ int selinux_disable(void) | |||
| 5830 | selinux_disabled = 1; | 5835 | selinux_disabled = 1; |
| 5831 | selinux_enabled = 0; | 5836 | selinux_enabled = 0; |
| 5832 | 5837 | ||
| 5833 | /* Try to destroy the avc node cache */ | ||
| 5834 | avc_disable(); | ||
| 5835 | |||
| 5836 | /* Reset security_ops to the secondary module, dummy or capability. */ | 5838 | /* Reset security_ops to the secondary module, dummy or capability. */ |
| 5837 | security_ops = secondary_ops; | 5839 | security_ops = secondary_ops; |
| 5838 | 5840 | ||
| 5841 | /* Try to destroy the avc node cache */ | ||
| 5842 | avc_disable(); | ||
| 5843 | |||
| 5839 | /* Unregister netfilter hooks. */ | 5844 | /* Unregister netfilter hooks. */ |
| 5840 | selinux_nf_ip_exit(); | 5845 | selinux_nf_ip_exit(); |
| 5841 | 5846 | ||
