aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/exec.c4
-rw-r--r--fs/file_table.c2
-rw-r--r--fs/inode.c10
-rw-r--r--mm/mmap.c4
-rw-r--r--security/integrity/ima/Kconfig1
-rw-r--r--security/security.c28
6 files changed, 26 insertions, 23 deletions
diff --git a/fs/exec.c b/fs/exec.c
index d49be6bc1793..d164342c2b69 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -46,7 +46,6 @@
46#include <linux/proc_fs.h> 46#include <linux/proc_fs.h>
47#include <linux/mount.h> 47#include <linux/mount.h>
48#include <linux/security.h> 48#include <linux/security.h>
49#include <linux/ima.h>
50#include <linux/syscalls.h> 49#include <linux/syscalls.h>
51#include <linux/tsacct_kern.h> 50#include <linux/tsacct_kern.h>
52#include <linux/cn_proc.h> 51#include <linux/cn_proc.h>
@@ -1211,9 +1210,6 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
1211 retval = security_bprm_check(bprm); 1210 retval = security_bprm_check(bprm);
1212 if (retval) 1211 if (retval)
1213 return retval; 1212 return retval;
1214 retval = ima_bprm_check(bprm);
1215 if (retval)
1216 return retval;
1217 1213
1218 /* kernel module loader fixup */ 1214 /* kernel module loader fixup */
1219 /* so we don't try to load run modprobe in kernel space. */ 1215 /* so we don't try to load run modprobe in kernel space. */
diff --git a/fs/file_table.c b/fs/file_table.c
index 8eb44042e009..4bef4c01ec6f 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -13,7 +13,6 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/fs.h> 14#include <linux/fs.h>
15#include <linux/security.h> 15#include <linux/security.h>
16#include <linux/ima.h>
17#include <linux/eventpoll.h> 16#include <linux/eventpoll.h>
18#include <linux/rcupdate.h> 17#include <linux/rcupdate.h>
19#include <linux/mount.h> 18#include <linux/mount.h>
@@ -280,7 +279,6 @@ void __fput(struct file *file)
280 if (file->f_op && file->f_op->release) 279 if (file->f_op && file->f_op->release)
281 file->f_op->release(inode, file); 280 file->f_op->release(inode, file);
282 security_file_free(file); 281 security_file_free(file);
283 ima_file_free(file);
284 if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL)) 282 if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL))
285 cdev_put(inode->i_cdev); 283 cdev_put(inode->i_cdev);
286 fops_put(file->f_op); 284 fops_put(file->f_op);
diff --git a/fs/inode.c b/fs/inode.c
index 4d8e3be55976..06c1f02de611 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -18,7 +18,6 @@
18#include <linux/hash.h> 18#include <linux/hash.h>
19#include <linux/swap.h> 19#include <linux/swap.h>
20#include <linux/security.h> 20#include <linux/security.h>
21#include <linux/ima.h>
22#include <linux/pagemap.h> 21#include <linux/pagemap.h>
23#include <linux/cdev.h> 22#include <linux/cdev.h>
24#include <linux/bootmem.h> 23#include <linux/bootmem.h>
@@ -157,11 +156,6 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
157 156
158 if (security_inode_alloc(inode)) 157 if (security_inode_alloc(inode))
159 goto out; 158 goto out;
160
161 /* allocate and initialize an i_integrity */
162 if (ima_inode_alloc(inode))
163 goto out_free_security;
164
165 spin_lock_init(&inode->i_lock); 159 spin_lock_init(&inode->i_lock);
166 lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key); 160 lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key);
167 161
@@ -201,9 +195,6 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
201#endif 195#endif
202 196
203 return 0; 197 return 0;
204
205out_free_security:
206 security_inode_free(inode);
207out: 198out:
208 return -ENOMEM; 199 return -ENOMEM;
209} 200}
@@ -235,7 +226,6 @@ static struct inode *alloc_inode(struct super_block *sb)
235void __destroy_inode(struct inode *inode) 226void __destroy_inode(struct inode *inode)
236{ 227{
237 BUG_ON(inode_has_buffers(inode)); 228 BUG_ON(inode_has_buffers(inode));
238 ima_inode_free(inode);
239 security_inode_free(inode); 229 security_inode_free(inode);
240 fsnotify_inode_delete(inode); 230 fsnotify_inode_delete(inode);
241#ifdef CONFIG_FS_POSIX_ACL 231#ifdef CONFIG_FS_POSIX_ACL
diff --git a/mm/mmap.c b/mm/mmap.c
index 73f5e4b64010..292ddc3cef9c 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -20,7 +20,6 @@
20#include <linux/fs.h> 20#include <linux/fs.h>
21#include <linux/personality.h> 21#include <linux/personality.h>
22#include <linux/security.h> 22#include <linux/security.h>
23#include <linux/ima.h>
24#include <linux/hugetlb.h> 23#include <linux/hugetlb.h>
25#include <linux/profile.h> 24#include <linux/profile.h>
26#include <linux/module.h> 25#include <linux/module.h>
@@ -1061,9 +1060,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1061 error = security_file_mmap(file, reqprot, prot, flags, addr, 0); 1060 error = security_file_mmap(file, reqprot, prot, flags, addr, 0);
1062 if (error) 1061 if (error)
1063 return error; 1062 return error;
1064 error = ima_file_mmap(file, prot);
1065 if (error)
1066 return error;
1067 1063
1068 return mmap_region(file, addr, len, flags, vm_flags, pgoff); 1064 return mmap_region(file, addr, len, flags, vm_flags, pgoff);
1069} 1065}
diff --git a/security/integrity/ima/Kconfig b/security/integrity/ima/Kconfig
index 53d9764e8f09..3d7846de8069 100644
--- a/security/integrity/ima/Kconfig
+++ b/security/integrity/ima/Kconfig
@@ -3,6 +3,7 @@
3config IMA 3config IMA
4 bool "Integrity Measurement Architecture(IMA)" 4 bool "Integrity Measurement Architecture(IMA)"
5 depends on ACPI 5 depends on ACPI
6 depends on SECURITY
6 select SECURITYFS 7 select SECURITYFS
7 select CRYPTO 8 select CRYPTO
8 select CRYPTO_HMAC 9 select CRYPTO_HMAC
diff --git a/security/security.c b/security/security.c
index 279757314a05..684d5ee655da 100644
--- a/security/security.c
+++ b/security/security.c
@@ -16,6 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/security.h> 18#include <linux/security.h>
19#include <linux/ima.h>
19 20
20/* Boot-time LSM user choice */ 21/* Boot-time LSM user choice */
21static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1]; 22static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1];
@@ -235,7 +236,12 @@ int security_bprm_set_creds(struct linux_binprm *bprm)
235 236
236int security_bprm_check(struct linux_binprm *bprm) 237int security_bprm_check(struct linux_binprm *bprm)
237{ 238{
238 return security_ops->bprm_check_security(bprm); 239 int ret;
240
241 ret = security_ops->bprm_check_security(bprm);
242 if (ret)
243 return ret;
244 return ima_bprm_check(bprm);
239} 245}
240 246
241void security_bprm_committing_creds(struct linux_binprm *bprm) 247void security_bprm_committing_creds(struct linux_binprm *bprm)
@@ -352,12 +358,21 @@ EXPORT_SYMBOL(security_sb_parse_opts_str);
352 358
353int security_inode_alloc(struct inode *inode) 359int security_inode_alloc(struct inode *inode)
354{ 360{
361 int ret;
362
355 inode->i_security = NULL; 363 inode->i_security = NULL;
356 return security_ops->inode_alloc_security(inode); 364 ret = security_ops->inode_alloc_security(inode);
365 if (ret)
366 return ret;
367 ret = ima_inode_alloc(inode);
368 if (ret)
369 security_inode_free(inode);
370 return ret;
357} 371}
358 372
359void security_inode_free(struct inode *inode) 373void security_inode_free(struct inode *inode)
360{ 374{
375 ima_inode_free(inode);
361 security_ops->inode_free_security(inode); 376 security_ops->inode_free_security(inode);
362} 377}
363 378
@@ -648,6 +663,8 @@ int security_file_alloc(struct file *file)
648void security_file_free(struct file *file) 663void security_file_free(struct file *file)
649{ 664{
650 security_ops->file_free_security(file); 665 security_ops->file_free_security(file);
666 if (file->f_dentry)
667 ima_file_free(file);
651} 668}
652 669
653int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 670int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
@@ -659,7 +676,12 @@ int security_file_mmap(struct file *file, unsigned long reqprot,
659 unsigned long prot, unsigned long flags, 676 unsigned long prot, unsigned long flags,
660 unsigned long addr, unsigned long addr_only) 677 unsigned long addr, unsigned long addr_only)
661{ 678{
662 return security_ops->file_mmap(file, reqprot, prot, flags, addr, addr_only); 679 int ret;
680
681 ret = security_ops->file_mmap(file, reqprot, prot, flags, addr, addr_only);
682 if (ret)
683 return ret;
684 return ima_file_mmap(file, prot);
663} 685}
664 686
665int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, 687int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,