Inserting custom module taints kernel

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

Inserting custom module taints kernel



I just want to insert a module without tainting the kernel.



This is the file test1.c


test1.c


#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>

MODULE_LICENSE("GPL")
MODULE_AUTHOR("AUTHOR")
MODULE_DESCRIPTION("DESCRIPTION")

static int __init module_hello(void)
printk(KERN_ALERT "Hello");
return 0;


static void __exit module_bye(void)
printk(KERN_ALERT "Bye");


module_init(module_hello);
module_exit(module_bye);



and in the same folder, the file Makefile, as decribed in kernel.org section 3


Makefile


ifneq ($(KERNELRELEASE),)

obj-m := test1.o

else

KDIR ?= /lib/modules/`uname -r`/build

default:
$(MAKE) -C $(KDIR) M=$$PWD

endif



Executing make creates the necessary files correctly, but when I insert it I get the message Loading out-of-tree modules taints kernel, and I don't get the output of the module_hello until I remove the module, and after that, if I insert it again I get the message from the module_bye function, but not the hello one.


make


Loading out-of-tree modules taints kernel


module_hello


module_bye




2 Answers
2



The delay in message is because of missing n at the end of each print. a n puts the data from the kernel message buffer to file.


n


n



For the tainted kernel refer to this link



As in kernel.org section 1,



[...] all modules are initially developed and built
out-of-tree.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

PySpark count values by condition

Trying to Print Gridster Items to PDF without overlapping contents