hello.c
#include/*Needed by all modules*/
#include/*Needed for KERN_* */
#include/* Needed for the macros */
#include
#include
MODULE_LICENSE("GPL");
staticinthello_init(void)
{
printk(KERN_WARNING"the process is\"%d\"(pid %i)\n",current->comm,current->pid);
return0;
}
staticvoidhello_exit(void)
{
printk("Bye, kernel!\n");
}
/* main module function*/
module_init(hello_init);
module_exit(hello_exit);
root@ubuntu:~/Desktop# insmod ./hello.ko
root@ubuntu:~/Desktop# tail /var/log/kern.log
Aug2607:05:06ubuntu kernel:[38.280651]audit:type=1400audit(1535292306.730:64):apparmor="STATUS"operation="profile_replace"profile="unconfined"name="/usr/sbin/cupsd"pid=