From: toqeer83@gmail.com (toqeer ali)
To: kernelnewbies@lists.kernelnewbies.org
Subject: LSM skeleton module printk message not showing in dmesg
Date: Fri, 20 May 2011 12:29:50 +0800 [thread overview]
Message-ID: <BANLkTimhN6YCYZkYYB7kXEOttiyUT6DZ3w@mail.gmail.com> (raw)
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
next reply other threads:[~2011-05-20 4:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-20 4:29 toqeer ali [this message]
[not found] ` <4DD60281.7060605@googlemail.com>
2011-05-20 6:40 ` LSM skeleton module printk message not showing in dmesg toqeer ali
[not found] ` <4DD60F89.4010204@googlemail.com>
2011-05-20 7:40 ` toqeer ali
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BANLkTimhN6YCYZkYYB7kXEOttiyUT6DZ3w@mail.gmail.com \
--to=toqeer83@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).