Skip to content

tianyuzhou95/hello-lkm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hello-lkm

Hello world example for lkm (loadable kernel module)

Instructions

$ make
$ sudo insmod hello-lkm.ko
$ sudo rmmod hello-lkm

main_user.c

$ gcc -o main_user main_user.c
$ ./main_user

If you get Segmentation fault (core dumped) after running the main_user, it's probably because the rmdpc is not allowed. It might due to the protection principles done by kernal 4.x, please see more information in the github issue. For simply remove this protection, do this:

$ sudo sh -c "echo '2' > /sys/bus/event_source/devices/cpu/rdpmc"

problem about insmod

If you get

insmod: ERROR: could not insert module simple-lkm.ko: Operation not permited

when you try sudo insmod simple-lkm.ko after you build the module, it is probably because your BIOS setting. In my case, when I use dmesg | tail -5 to see what actually happened, I get:

Lockdown: insmod: Loading of unsigned module is restricted; see man kernel_lockdoen.7

Then I check the configuration of my BIOS setting, I found my PC's Secure Boot is enabled, so I turned it off. After I restart the PC, I installed the module successfully.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 96.7%
  • Makefile 3.3%