dufault.info

Ramblings of a phone weenie, Linux sysadmin, and other things geeky

17  07 2008

Forcibly Triggering a Kernel Panic on Linux

This might sound strange, as people usually want to fix or prevent these from happening, I’m 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 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 kernel sources installed at /usr/src/linux of your current running 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

Share and Enjoy:
  • Digg
  • del.icio.us
  • Mixx
  • StumbleUpon
  • Technorati

No Comments

(Required)
(Required, will not be published)

This site uses KeywordLuv. Enter YourName@YourKeywords in the Name field to take advantage.

« Gnome Do Scripts To Make Administrating Lots of MySQL Databases a Little Easier »