SLIM: debug output
RFC PATCH 6/6 SLIM: debug output
This patch contains all the necessary pieces to add debugging output to SLIM.
---
security/slim/slim.h | 16 + security/slim/slm_main.c | 499 +++++++++++++++++++++++++++++++----- security/slim/slm_secfs.c | 117 ++++++++ 3 files changed, 570 insertions(+), 62 deletions(-)
security/slim/slim.h +16 -0
@@ -100,3 +103,19 @@ extern int slm_init_config(void);extern __init int slm_init_secfs (void ); extern __exit void slm_cleanup_secfs(void); + +extern __init int slm_init_debugfs (void ); +extern __exit void slm_cleanup_debugfs(void); + +extern unsigned int slm_debug; +enum slm_debug_level { +SLM_BASE =1 , +SLM_INTEGRITY =2 , +SLM_SECRECY =4 , +SLM_VERBOSE =8 , +}; + +#undef dprintk +#define dprintk(level, format, a...) \ + if (slm_debug & level) \ + printk(KERN_INFO format, ##a)
security/slim/slm_main.c +417 -58
859 lines not on this page · raw message
if (mod_reg_security(MY_NAME, &slm_security_ops)) {+ dprintk(SLM_BASE,
+ "%s: security hooks registration "
+ "failed\n", __FUNCTION__);
slm_cleanup_secfs();
+ slm_cleanup_debugfs();
return -EINVAL; }
secondary = 1;
}
+ dprintk(SLM_BASE, "%s: registered security hooks\n", __FUNCTION__);
return 0;
}
static void __exit cleanup_slm(void)
{
slm_cleanup_secfs();
- if (secondary)
- mod_unreg_security(MY_NAME, &slm_security_ops);
- else
- unregister_security(&slm_security_ops);
+ slm_cleanup_debugfs();
+ if (secondary) {
+ if (mod_unreg_security(MY_NAME, &slm_security_ops))
+ dprintk(SLM_BASE,
+ "%s: failure unregistering module "
+ "with primary module.\n", __FUNCTION__);
+ } else if (unregister_security(&slm_security_ops)) {
+ dprintk(SLM_BASE,
+ "%s: failure unregistering module "
+ "with the kernel\n", __FUNCTION__);
+ }
+ dprintk(SLM_BASE, "%s: completed \n", __FUNCTION__);
}
module_init(init_slm);
@@ -1525,4 +1897,7 @@ module_exit(cleanup_slm);
module_param(slm_xattr_name, charp, 0444); MODULE_PARM_DESC(slm_xattr_name, "SLIM extended attribute");
+module_param(slm_debug, uint, 1); +MODULE_DESCRIPTION("Simple Linux Integrity Module"); +
MODULE_LICENSE("GPL");
security/slim/slm_secfs.c +117 -0
141 lines not on this page · raw message