Nullpo-mod is a linux kernel module that implements a character device file that causes SEGV when it is about be either read or written.
-
Build the kernel module.
$ make
-
Load the built module.
$ sudo insmod nullpo.ko
Reading more than or equal to 1 byte from /dev/nullpo will cause segmentation fault.
$ cat /den/nullpo
Segmentation fault (core dumped)
Writing more than or equal to 1 byte to /dev/nullpo will also cause segmentation fault.
$ echo foo | tee /dev/nullpo
Segmentation fault (core dumped)
read()/write() call for /dev/nullpo with 0 bytes reading/writing will be success with return value zero.
$ echo -n | tee /dev/nullpo
$ echo $?
0
Warning: redirecing to/from /dev/nullpo may cause a shell crash.
You can install the module to the system and load from there.
$ sudo make install
$ sudo depmod
$ modprobe nullpo
Depending to the system settings, /dev/nullpo cannot be opend except by root
user. To grant permission for other user to open the device file, you have
to create appropriate udev rules. There is a sample udev configuration file
99-nullpo.rules
in the source directory. Putting that file into /etc/udev/rules.d
grant permission for all users to read/write /dev/nullpo from next module loading.