This might sound strange, as people usually want to fix or prevent their computer from kernel panicing, but I was trying to test / create a method of logging kernel panic messages to a remote logging server. All of the existing tutorials I found on the net were for Linux kernel version 2.4, or were incomplete.
My method involves creating a Linux kernel module, that when it’s inserted, causes the panic.
Here’s my my tarball: (includes the module source and a makefile)
kernelpanic.tgz
Here’s how to compile it: (you’ll need the the build kernel sources installed at /usr/src/linux of your current running kernel version)
make -C /lib/modules/$(uname -r)/build M=$(pwd)
After it’s done compiling: (WARNING, THIS WILL CRASH THE MACHINE, and you need to be root)
insmod panic.ko
To recover from the crash, just reboot your computer.
Let me know if this is any good in the comments, and any improvements I can make!
Should I obfuscate the source code at all to prevent misuse of this? Since you need root access to insert a kernel module, and anyone with root access can halt the machine, I find the ramifications of releasing this information moot. Comment!
Here’s where I found a quick howto on creating a Linux 2.6 kernel module:
http://tldp.org/LDP/lkmpg/2.6/html/x279.html
{ 2 comments… read them below or add one }
Thanks it works perfectly
The Makefile is currently a bit broken. If you replace the spaces at the start of the two make lines in the makefile by tabs, then you can build this project just by typing “make”.
Other than that, and the fact that this seems to crash my kernel, this is pretty useful.
{ 1 trackback }