/* * Security plug functions * * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com> * Copyright (C) 2001-2002 Greg Kroah-Hartman <greg@kroah.com> * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */#include <linux/capability.h>#include <linux/dcache.h>#include <linux/module.h>#include <linux/init.h>#include <linux/kernel.h>#include <linux/security.h>#include <linux/integrity.h>#include <linux/ima.h>#include <linux/evm.h>#include <linux/fsnotify.h>#include <linux/mman.h>#include <linux/mount.h>#include <linux/personality.h>#include <linux/backing-dev.h>#include <net/flow.h>#define MAX_LSM_EVM_XATTR 2/* Boot-time LSM user choice */static __initdata char chosen_lsm[SECURITY_NAME_MAX +1] =
CONFIG_DEFAULT_SECURITY;static struct security_operations *security_ops;static struct security_operations default_security_ops = {.name ="default",};staticinlineint __init verify(struct security_operations *ops){/* verify the security_operations structure exists */if(!ops)return-EINVAL;security_fixup_ops(ops);return0;}static void __init do_security_initcalls(void){
initcall_t *call;
call = __security_initcall_start;while(call < __security_initcall_end) {(*call) ();
call++;}}/** * security_init - initializes the security framework * * This should be called early in the kernel initialization sequence. */int __init security_init(void){printk(KERN_INFO "Security Framework initialized\n");security_fixup_ops(&default_security_ops);
security_ops = &default_security_ops;do_security_initcalls();return0;}voidreset_security_ops(void){
security_ops = &default_security_ops;}/* Save user chosen LSM */