* LSM skeleton module printk message not showing in dmesg
@ 2011-05-20 4:29 toqeer ali
[not found] ` <4DD60281.7060605@googlemail.com>
0 siblings, 1 reply; 3+ messages in thread
From: toqeer ali @ 2011-05-20 4:29 UTC (permalink / raw)
To: kernelnewbies
Hi All,
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.
Below are steps i did to enable the printk messages in the LSM module.
What i did is download linux kernel 2.6.33.3.
1) added the line source security/lsmcustommod/Kconfig in
linuxsrc/security/Kconfig near ima/Kconfig.
2) added "subdir-$(CONFIG_SECURITY_LSMCUSTOMMOD) += lsmcustommod"
line at linuxsrc/security/Makefile
3) created a directory in linuxsrc/security/lsmcustommod and putted three
files
i) lsmcustommod.c
ii) Kconfig
iii) Makefile
*Kconfig file contents*
config SECURITY_LSMCUSTOMMOD
bool "LSMCUSTOMMOD Support"
depends on SECURITY
select NETWORK_SECMARK
default n
help
*Makefile Contents*
obj-$(CONFIG_SECURITY_LSMCUSTOMMOD) := lsmcustommod.o
*lsmcustommod.c* contents
static __init lsmcustommod_init(void){
/* register the hooks */
if (register_security(&lsmcustommod_ops))
panic("lsmcustommod: Unable to register lsmcustommod with
kernel.\n");
else
printk("lsmcustommod: registered with the kernel\n");
return 0;
}
static void __exit lsmcustommod_exit (void)
{
return;
}
module_init (lsmcustommod_init);
module_exit (lsmcustommod_exit);
MODULE_DESCRIPTION("lsmcustommod");
MODULE_LICENSE("GPL");
#endif /* CONFIG_SECURITY_LSMCUSTOMMOD */
After that I also added some return 0 and printk statments in the
lsmcustommod_ops stucture.
lastly disabled all modules in make menuconfig and select LSMCUTOMMOD in
security sections of the menufile and compile the kernel by the following
command.
make && make modules && make modules_install && make install
updategrub2
--
Toqeer Ali Syed
Red Hat Certified Engineer
mob: +60166205504
mob: +92 321 9059916
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110520/24cf5133/attachment.html
^ permalink raw reply [flat|nested] 3+ messages in thread[parent not found: <4DD60281.7060605@googlemail.com>]
* LSM skeleton module printk message not showing in dmesg [not found] ` <4DD60281.7060605@googlemail.com> @ 2011-05-20 6:40 ` toqeer ali [not found] ` <4DD60F89.4010204@googlemail.com> 0 siblings, 1 reply; 3+ messages in thread From: toqeer ali @ 2011-05-20 6:40 UTC (permalink / raw) To: kernelnewbies Hi Mosta, Thanks for the prompt reply, I added the same printk message in the other kernel files like here /usr/src/linux-2.6.33.3/init/calibrate.c int lps_precision = LPS_PREC; printk("*** Just testing prinkt to work ***\n"); static bool printed; and recompiled the kernel and its showing in the dmesg. Is this means kernel logger is fine? also can please verify the steps i made to make lsm module just for pirnkt message. Regards On Fri, May 20, 2011 at 1:56 PM, mosta <mosta.me@googlemail.com> wrote: > you have to check at what level you're kernel logger is and set it to > the according level. > > > greetings mosta > > On 05/20/11 06:29, toqeer ali wrote: > > Hi All, > > > > > > 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. > > > > Below are steps i did to enable the printk messages in the LSM module. > > > > What i did is download linux kernel 2.6.33.3. > > > > 1) added the line source security/lsmcustommod/Kconfig in > > linuxsrc/security/Kconfig near ima/Kconfig. > > 2) added "subdir-$(CONFIG_SECURITY_LSMCUSTOMMOD) += > > lsmcustommod" line at linuxsrc/security/Makefile > > 3) created a directory in linuxsrc/security/lsmcustommod and putted > > three files > > > > i) lsmcustommod.c > > ii) Kconfig > > iii) Makefile > > > > *Kconfig file contents* > > > > config SECURITY_LSMCUSTOMMOD > > bool "LSMCUSTOMMOD Support" > > depends on SECURITY > > select NETWORK_SECMARK > > default n > > help > > > > *Makefile Contents* > > > > obj-$(CONFIG_SECURITY_LSMCUSTOMMOD) := lsmcustommod.o > > > > *lsmcustommod.c* contents > > > > static __init lsmcustommod_init(void){ > > /* register the hooks */ > > > > if (register_security(&lsmcustommod_ops)) > > panic("lsmcustommod: Unable to register lsmcustommod > > with kernel.\n"); > > else > > printk("lsmcustommod: registered with the kernel\n"); > > > > return 0; > > } > > > > static void __exit lsmcustommod_exit (void) > > { > > return; > > } > > > > > > > > module_init (lsmcustommod_init); > > module_exit (lsmcustommod_exit); > > > > MODULE_DESCRIPTION("lsmcustommod"); > > MODULE_LICENSE("GPL"); > > #endif /* CONFIG_SECURITY_LSMCUSTOMMOD */ > > > > > > > > After that I also added some return 0 and printk statments in the > > lsmcustommod_ops stucture. > > > > lastly disabled all modules in make menuconfig and select LSMCUTOMMOD > > in security sections of the menufile and compile the kernel by the > > following command. > > > > make && make modules && make modules_install && make install > > updategrub2 > > > > > > -- > > Toqeer Ali Syed > > > > Red Hat Certified Engineer > > > > mob: +60166205504 <tel:%2B60166205504> > > mob: +92 321 9059916 <tel:%2B92%20321%209059916> > > > > > > _______________________________________________ > > Kernelnewbies mailing list > > Kernelnewbies at kernelnewbies.org > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > -- Toqeer Ali Syed Red Hat Certified Engineer mob: +60166205504 mob: +92 321 9059916 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110520/8b33913c/attachment.html ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <4DD60F89.4010204@googlemail.com>]
* LSM skeleton module printk message not showing in dmesg [not found] ` <4DD60F89.4010204@googlemail.com> @ 2011-05-20 7:40 ` toqeer ali 0 siblings, 0 replies; 3+ messages in thread From: toqeer ali @ 2011-05-20 7:40 UTC (permalink / raw) To: kernelnewbies Hi Mosta, I am using klogd and its running and also at boot time. I also search my printk message in these files /var/log/kern.log /var/log/boot, /var/log/dmesg, /var/log/messages, but no luck, anything else i need to look for? Regards On Fri, May 20, 2011 at 2:51 PM, mosta <mosta.me@googlemail.com> wrote: > This depends on your kernel logger. Do you use klogd/ sysklogd or > another one? > > On 05/20/11 08:40, toqeer ali wrote: > > Hi Mosta, > > > > Thanks for the prompt reply, I added the same printk message in the > > other kernel files like here /usr/src/linux-2.6.33.3/init/calibrate.c > > > > int lps_precision = LPS_PREC; > > printk("*** Just testing prinkt to work ***\n"); > > static bool printed; > > > > and recompiled the kernel and its showing in the dmesg. Is this means > > kernel logger is fine? > > > > also can please verify the steps i made to make lsm module just for > > pirnkt message. > > > > Regards > > > > On Fri, May 20, 2011 at 1:56 PM, mosta <mosta.me > > <http://mosta.me>@googlemail.com <http://googlemail.com>> wrote: > > > > you have to check at what level you're kernel logger is and set it to > > the according level. > > > > > > greetings mosta > > > > On 05/20/11 06:29, toqeer ali wrote: > > > Hi All, > > > > > > > > > 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. > > > > > > Below are steps i did to enable the printk messages in the LSM > > module. > > > > > > What i did is download linux kernel 2.6.33.3. > > > > > > 1) added the line source security/lsmcustommod/Kconfig in > > > linuxsrc/security/Kconfig near ima/Kconfig. > > > 2) added "subdir-$(CONFIG_SECURITY_LSMCUSTOMMOD) += > > > lsmcustommod" line at linuxsrc/security/Makefile > > > 3) created a directory in linuxsrc/security/lsmcustommod and putted > > > three files > > > > > > i) lsmcustommod.c > > > ii) Kconfig > > > iii) Makefile > > > > > > *Kconfig file contents* > > > > > > config SECURITY_LSMCUSTOMMOD > > > bool "LSMCUSTOMMOD Support" > > > depends on SECURITY > > > select NETWORK_SECMARK > > > default n > > > help > > > > > > *Makefile Contents* > > > > > > obj-$(CONFIG_SECURITY_LSMCUSTOMMOD) := lsmcustommod.o > > > > > > *lsmcustommod.c* contents > > > > > > static __init lsmcustommod_init(void){ > > > /* register the hooks */ > > > > > > if (register_security(&lsmcustommod_ops)) > > > panic("lsmcustommod: Unable to register > lsmcustommod > > > with kernel.\n"); > > > else > > > printk("lsmcustommod: registered with the > > kernel\n"); > > > > > > return 0; > > > } > > > > > > static void __exit lsmcustommod_exit (void) > > > { > > > return; > > > } > > > > > > > > > > > > module_init (lsmcustommod_init); > > > module_exit (lsmcustommod_exit); > > > > > > MODULE_DESCRIPTION("lsmcustommod"); > > > MODULE_LICENSE("GPL"); > > > #endif /* CONFIG_SECURITY_LSMCUSTOMMOD */ > > > > > > > > > > > > After that I also added some return 0 and printk statments in the > > > lsmcustommod_ops stucture. > > > > > > lastly disabled all modules in make menuconfig and select > > LSMCUTOMMOD > > > in security sections of the menufile and compile the kernel by the > > > following command. > > > > > > make && make modules && make modules_install && make install > > > updategrub2 > > > > > > > > > -- > > > Toqeer Ali Syed > > > > > > Red Hat Certified Engineer > > > > > > mob: +60166205504 <tel:%2B60166205504> <tel:%2B60166205504> > > > mob: +92 321 9059916 <tel:%2B92%20321%209059916> > > <tel:%2B92%20321%209059916> > > > > > > > > > _______________________________________________ > > > Kernelnewbies mailing list > > > Kernelnewbies at kernelnewbies.org > > <mailto:Kernelnewbies@kernelnewbies.org> > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > > > > > > > > -- > > Toqeer Ali Syed > > > > Red Hat Certified Engineer > > > > mob: +60166205504 > > mob: +92 321 9059916 > > -- Toqeer Ali Syed Red Hat Certified Engineer mob: +60166205504 mob: +92 321 9059916 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110520/54ea1d00/attachment-0001.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-20 7:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-20 4:29 LSM skeleton module printk message not showing in dmesg toqeer ali
[not found] ` <4DD60281.7060605@googlemail.com>
2011-05-20 6:40 ` toqeer ali
[not found] ` <4DD60F89.4010204@googlemail.com>
2011-05-20 7:40 ` toqeer ali
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).