security.c (8b8efb44033c7e86b3dc76f825c693ec92ae30e9) | security.c (6c21a7fb492bf7e2c4985937082ce58ddeca84bd) |
---|---|
1/* 2 * Security plug functions 3 * 4 * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com> 5 * Copyright (C) 2001-2002 Greg Kroah-Hartman <greg@kroah.com> 6 * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com> 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 */ 13 14#include <linux/capability.h> 15#include <linux/module.h> 16#include <linux/init.h> 17#include <linux/kernel.h> 18#include <linux/security.h> | 1/* 2 * Security plug functions 3 * 4 * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com> 5 * Copyright (C) 2001-2002 Greg Kroah-Hartman <greg@kroah.com> 6 * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com> 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 */ 13 14#include <linux/capability.h> 15#include <linux/module.h> 16#include <linux/init.h> 17#include <linux/kernel.h> 18#include <linux/security.h> |
19#include <linux/ima.h> |
|
19 20/* Boot-time LSM user choice */ 21static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1]; 22 23/* things that live in capability.c */ 24extern struct security_operations default_security_ops; 25extern void security_fixup_ops(struct security_operations *ops); 26 --- 203 unchanged lines hidden (view full) --- 230 231int security_bprm_set_creds(struct linux_binprm *bprm) 232{ 233 return security_ops->bprm_set_creds(bprm); 234} 235 236int security_bprm_check(struct linux_binprm *bprm) 237{ | 20 21/* Boot-time LSM user choice */ 22static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1]; 23 24/* things that live in capability.c */ 25extern struct security_operations default_security_ops; 26extern void security_fixup_ops(struct security_operations *ops); 27 --- 203 unchanged lines hidden (view full) --- 231 232int security_bprm_set_creds(struct linux_binprm *bprm) 233{ 234 return security_ops->bprm_set_creds(bprm); 235} 236 237int security_bprm_check(struct linux_binprm *bprm) 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} 240 241void security_bprm_committing_creds(struct linux_binprm *bprm) 242{ 243 security_ops->bprm_committing_creds(bprm); 244} 245 246void security_bprm_committed_creds(struct linux_binprm *bprm) --- 100 unchanged lines hidden (view full) --- 347int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts) 348{ 349 return security_ops->sb_parse_opts_str(options, opts); 350} 351EXPORT_SYMBOL(security_sb_parse_opts_str); 352 353int security_inode_alloc(struct inode *inode) 354{ | 245} 246 247void security_bprm_committing_creds(struct linux_binprm *bprm) 248{ 249 security_ops->bprm_committing_creds(bprm); 250} 251 252void security_bprm_committed_creds(struct linux_binprm *bprm) --- 100 unchanged lines hidden (view full) --- 353int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts) 354{ 355 return security_ops->sb_parse_opts_str(options, opts); 356} 357EXPORT_SYMBOL(security_sb_parse_opts_str); 358 359int security_inode_alloc(struct inode *inode) 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} 358 359void security_inode_free(struct inode *inode) 360{ | 371} 372 373void security_inode_free(struct inode *inode) 374{ |
375 ima_inode_free(inode); |
|
361 security_ops->inode_free_security(inode); 362} 363 364int security_inode_init_security(struct inode *inode, struct inode *dir, 365 char **name, void **value, size_t *len) 366{ 367 if (unlikely(IS_PRIVATE(inode))) 368 return -EOPNOTSUPP; --- 274 unchanged lines hidden (view full) --- 643int security_file_alloc(struct file *file) 644{ 645 return security_ops->file_alloc_security(file); 646} 647 648void security_file_free(struct file *file) 649{ 650 security_ops->file_free_security(file); | 376 security_ops->inode_free_security(inode); 377} 378 379int security_inode_init_security(struct inode *inode, struct inode *dir, 380 char **name, void **value, size_t *len) 381{ 382 if (unlikely(IS_PRIVATE(inode))) 383 return -EOPNOTSUPP; --- 274 unchanged lines hidden (view full) --- 658int security_file_alloc(struct file *file) 659{ 660 return security_ops->file_alloc_security(file); 661} 662 663void security_file_free(struct file *file) 664{ 665 security_ops->file_free_security(file); |
666 if (file->f_dentry) 667 ima_file_free(file); |
|
651} 652 653int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 654{ 655 return security_ops->file_ioctl(file, cmd, arg); 656} 657 658int security_file_mmap(struct file *file, unsigned long reqprot, 659 unsigned long prot, unsigned long flags, 660 unsigned long addr, unsigned long addr_only) 661{ | 668} 669 670int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 671{ 672 return security_ops->file_ioctl(file, cmd, arg); 673} 674 675int security_file_mmap(struct file *file, unsigned long reqprot, 676 unsigned long prot, unsigned long flags, 677 unsigned long addr, unsigned long addr_only) 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} 664 665int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, 666 unsigned long prot) 667{ 668 return security_ops->file_mprotect(vma, reqprot, prot); 669} 670 --- 654 unchanged lines hidden --- | 685} 686 687int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, 688 unsigned long prot) 689{ 690 return security_ops->file_mprotect(vma, reqprot, prot); 691} 692 --- 654 unchanged lines hidden --- |