I decided to explain the basics of a Linux Kernel Module with humor. I am not saying this is a good idea for April’s fool, but it is quite close 😉
This module shares some ideas with the post about LD_PRELOAD, but this time it is not to defend ourselves. The module will replace the open syscall for our own where it will detect if we are opening an mp3 or a jpg file. This idea was taken from this talk of Julia Evans.
As always, all the code used in this post is available in this repo.
Skeleton of a Linux Kernel Module
The following code is the skeleton of a Linux Kernel Module