Hi All,<br><br><br>I am writing a skeleton LSM module to only print the message at boot time, but I could not see any printk message in the dmesg.<br><br>Below are steps i did to enable the printk messages in the LSM module.<br>
<br> What i did is download linux kernel 2.6.33.3. <br><br>1) added the line source security/lsmcustommod/Kconfig in linuxsrc/security/Kconfig near ima/Kconfig. <br>2) added "subdir-$(CONFIG_SECURITY_LSMCUSTOMMOD) += lsmcustommod" line at linuxsrc/security/Makefile<br>
3) created a directory in linuxsrc/security/lsmcustommod and putted three files <br><br> i) lsmcustommod.c <br> ii) Kconfig<br> iii) Makefile<br><br><b>Kconfig file contents</b><br><br>config SECURITY_LSMCUSTOMMOD<br>
bool "LSMCUSTOMMOD Support"<br> depends on SECURITY<br> select NETWORK_SECMARK<br> default n<br> help<br><br><b>Makefile Contents</b><br><br>obj-$(CONFIG_SECURITY_LSMCUSTOMMOD) := lsmcustommod.o<br>
<br><b>lsmcustommod.c</b> contents<br><br>static __init lsmcustommod_init(void){<br> /* register the hooks */<br><br> if (register_security(&lsmcustommod_ops))<br> panic("lsmcustommod: Unable to register lsmcustommod with kernel.\n");<br>
else<br> printk("lsmcustommod: registered with the kernel\n");<br><br> return 0;<br>}<br><br>static void __exit lsmcustommod_exit (void)<br>{<br> return;<br>}<br><br><br><br>
module_init (lsmcustommod_init);<br>module_exit (lsmcustommod_exit);<br><br>MODULE_DESCRIPTION("lsmcustommod");<br>MODULE_LICENSE("GPL");<br>#endif /* CONFIG_SECURITY_LSMCUSTOMMOD */<br><br><br><br>After that I also added some return 0 and printk statments in the lsmcustommod_ops stucture.<br>
<br>lastly disabled all modules in make menuconfig and select LSMCUTOMMOD in security sections of the menufile and compile the kernel by the following command.<br><br>make && make modules && make modules_install && make install<br>
updategrub2<br><br><br>-- <br>Toqeer Ali Syed<br><br>Red Hat Certified Engineer<br><br>
mob: <a href="tel:%2B60166205504" value="+60166205504" target="_blank">+60166205504</a><br>mob: <a href="tel:%2B92%20321%209059916" value="+923219059916" target="_blank">+92 321 9059916</a><br>