static int __init lowmem_init(void) { int r; /* register ourselves with the security framework */ if (register_security(&lowmem_security_ops)) { printk(KERN_ERR MY_NAME ": Failure registering with the kernel\n"); return -EINVAL; } /* initialize the uids vector */ memset(allowed_uids, 0, sizeof(allowed_uids)); lowmem_table_header = register_sysctl_table(lowmem_root_table); if (unlikely(!lowmem_table_header)) return -EPERM; r = sysfs_create_group(kernel_kobj, &lowmem_attr_group); if (unlikely(r)) return r; printk(KERN_INFO MY_NAME ": Module initialized.\n"); return 0; }
static int __init realtime_init(void) { /* register ourselves with the security framework */ if (register_security(&capability_ops)) { /* try registering with primary module */ if (mod_reg_security(MY_NAME, &capability_ops)) { printk(KERN_INFO RT_ERR "Failure registering " "capabilities with primary security module.\n"); printk(KERN_INFO RT_ERR "Is kernel configured " "with CONFIG_SECURITY_CAPABILITIES=m?\n"); return -EINVAL; } secondary = 1; } if (rt_any) printk(KERN_INFO RT_LSM "initialized (all groups, mlock=%d)\n", rt_mlock); else if (rt_gid == -1) printk(KERN_INFO RT_LSM "initialized (no groups, mlock=%d)\n", rt_mlock); else printk(KERN_INFO RT_LSM "initialized (group %d, mlock=%d)\n", rt_gid, rt_mlock); return 0; }
static int __init lsm_file_init(void) { if(register_security(&lsm_test_security_ops)){ printk("register error ..........\n"); return -1; } printk("lsm_file init..\n "); return 0; }
static int __init sealime_init(void) { if (register_security(&sealime_security_ops)) { printk(KERN_INFO "[SEAndroid_Lime] Failure registering LSM\n"); return -EINVAL; } printk(KERN_INFO "[SEAndroid_Lime] LSM module initialized\n"); return 0; }
static int __init task_init(void) { printk("my task_kill module is working..\n"); if (register_security(&task_ops)) { printk("register error..\n"); return -1; } return 0; }
static int __init sbrack_init(void){ /* registering the hooks */ if (register_security(&sbrack_ops)) printk("sbrack: Unable to register sbrack with kernel.\n"); else printk("sbrack: Registered with the kernel\n"); return 0; }
static int __init chromiumos_security_init(void) { int error; error = register_security(&chromiumos_security_ops); if (error) panic("Could not register chromiumos security module"); return error; }
static __init int sony_ric_init(void) { if (!security_module_enable(&sony_ric_ops)) return 0; if (register_security(&sony_ric_ops)) pr_err(KERN_INFO "RIC: Sony RIC security ops failed to register\n"); pr_info("RIC: Sony RIC ops registered!\n"); return 0; }
static int __init rootplug_init (void) { /* register ourselves with the security framework */ if (register_security (&rootplug_security_ops)) { printk (KERN_INFO "Failure registering Root Plug module with the kernel\n"); return -EINVAL; } printk (KERN_INFO "Root Plug module initialized, " "vendor_id = %4.4x, product id = %4.4x\n", vendor_id, product_id); return 0; }
static int __init miyabi_init (void) { #if 0 if (register_security (&miyabi_security_ops)) { printk (KERN_INFO "Failure registering MIYABI LSM\n"); return -EINVAL; } printk (KERN_INFO "MIYABI LSM module initialized\n"); #endif return 0; }
static int __init init_verihmac(void) { if (!security_module_enable(&verihmac_security_ops)) return 0; if (register_security(&verihmac_security_ops) || init_srcu_struct(&verihmac_ss)) panic("Failure registering Verihmac Linux"); printk(VERI_INFO "verihmac Linux initialized\n"); isloaded =1; return 0; }
static int __init capability_init (void) { /* register ourselves with the security framework */ if (register_security (&capability_ops)) { printk (KERN_INFO "Failure registering capabilities with the kernel\n"); /* try registering with primary module */ if (mod_reg_security (MY_NAME, &capability_ops)) { printk (KERN_INFO "Failure registering capabilities " "with primary security module.\n"); return -EINVAL; } secondary = 1; } printk (KERN_INFO "Capability LSM initialized\n"); return 0; }
static int __init tuxguardian_init (void) { /* register ourselves with the security framework */ if (register_security (&tuxguardian_security_ops)) { printk(KERN_INFO "Failure registering TuxGuardian module with the kernel\n"); /* try registering as the primary module */ if (mod_reg_security (MY_NAME, &tuxguardian_security_ops)) { printk(KERN_INFO "Failure registering TuxGuardian as the primary security module\n"); return -EINVAL; } } printk (KERN_INFO "TuxGuardian initialized\n"); return 0; }
static int __init capability_init (void) { if (capability_disable) { printk(KERN_INFO "Capabilities disabled at initialization\n"); return 0; } /* register ourselves with the security framework */ if (register_security (&capability_ops)) { /* try registering with primary module */ if (mod_reg_security (KBUILD_MODNAME, &capability_ops)) { printk (KERN_INFO "Failure registering capabilities " "with primary security module.\n"); return -EINVAL; } secondary = 1; } printk (KERN_INFO "Capability LSM initialized%s\n", secondary ? " as secondary" : ""); return 0; }
int tpe_init(void) { int retval; secondary = 0; retval = register_security(&tpe_security_ops); if(unlikely(retval)) { retval = mod_reg_security(TPE_MODULE_NAME, &tpe_security_ops); if(unlikely(retval)) { TPE_INFO("Failed to register with kernel"); return -EINVAL; } secondary = 1; } retval = tpe_register_procfs(); if(unlikely(retval)) { tpe_exit(); return -EINVAL; } retval = tpe_init_acl(); if(unlikely(retval)) { tpe_exit(); return -EINVAL; } retval = tpe_init_conf(); if(unlikely(retval)) { tpe_exit(); return -EINVAL; } TPE_INFO("Registered successfully with the kernel"); return 0; }
static int __init init_mod(void){ int ret=0; root=NULL; proc_entry=proc_create("my_test",0,NULL,&proc_fops); if(proc_entry ==NULL){ ret=-ENOMEM; printk("Could not create the proc file\n"); } else{ printk("Module loaded successfully\n"); } ret=register_security(&rbac_ops); if(ret){ printk("Cannot register the security\n"); }else{ printk("Farhan security module : registered\n"); } return ret; }