All
I'm developing a module in Fedora14 with linux kernel 2.6.35. The OS is running in virtual box actually.
What I observed is that after I made some changes to my code and hit a taint kernel warning, the printk won't work any more, even if I revert the code to previous version. And then if I just copy the previous code to create another module with different name, it will work again... I'm not sure if it is a bug or not, but it is reproducible.
Following is the basic code which is working well. I can see the printk messages in /var/log/messages
sniffer.c
#include <linux/module.h>
static int __init sniffer_init(void)
{
printk(KERN_INFO "sniffer is initializing...");
printk(KERN_INFO "done!\n");
return 0;
}
static void __exit sniffer_exit(void)
{
printk(KERN_INFO "sniffer is cleaning up...");
printk(KERN_INFO "done!\n");
}
MODULE_AUTHOR("xyz");
MODULE_LICENSE("GPL");
module_init(sniffer_init);
module_exit(sniffer_exit);
Makefile
obj-m += sniffer.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Then I made the changes, which is just a test for a multi-file module
sniffer.c
#include <linux/module.h>
static int __init sniffer_init(void)
{
printk(KERN_INFO "sniffer is initializing...");
test_handler();
printk(KERN_INFO "done!\n");
return 0;
}
static void __exit sniffer_exit(void)
{
printk(KERN_INFO "sniffer is cleaning up...");
printk(KERN_INFO "done!\n");
}
MODULE_AUTHOR("WEICHAO HUANG");
MODULE_LICENSE("GPL");
module_init(sniffer_init);
module_exit(sniffer_exit);
Makefile
obj-m += sniffer.o
sniffer-objs := proto_handler.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
proto_handler.c
#include <linux/module.h>
void test_handler(void)
{
printk(KERN_INFO "this is a test");
}
proto_handler.h
void test_handler(void);
Then, after I make and run insmod, I see these messages in /var/log/messages
sniffer: module license 'unspecified' taints kernel
Disabling lock debugging due to kernel taint
Firstly, I don't know why these messages are displayed since I specified my license.
Secondly, after seeing these messages, I can never see the results of printk of this module any more by running insmod or rmmod, even if I revert my code. But as I said, I can just copy the previous code to a module with other name and it will work again. Is there something like blacklist in Linux?
Can anyone help me? Really appreciated!