A few things, mostly technical notes...

Tuesday, December 21, 2004

How to force a Linux box to panic...

How to force a panic?

[mdlug] netdump on Red Hat ES
GREG WOJTAK GWOJTAK at salliemae.com
Tue Oct 12 09:05:57 EDT 2004

* Previous message: [mdlug] Alternate antennae: inside the wireless CF card
* Next message: [mdlug] Sun & Kodak settle Java lawsuit
* Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

This is what I needed, but I couldn't get his code to compile, so I
re-wrote it based on the source:

#define __KERNEL__


extern int init_module(void);

int init_module (void)
panic(" panic has been called");
return 0;

compile with:
# cc -c -o panic.o -DMODULE -I/usr/src/linux-2.4/include panic.c

# file panic.o
panic.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not
# insmod panic.o
Warning: kernel-module version mismatch
panic.o was compiled for kernel version 2.4.21-20.ELsmp
while this kernel is version 2.4.21-15.0.4.ELsmp
Warning: loading panic.o will taint the kernel: no license
See http://www.tux.org/lkml/#export-tainted for information about
tainted modules
Warning: loading panic.o will taint the kernel: forced load
Read from remote host sqcjbafi10: Connection timed out
Connection to sqcjbafi10 closed.

Sometimes, there is nothing like the feeling of having the power to
crash a server.

netdump works great, BTW. It sent over a core file and the contents
of what would have gone in syslog to the netdump server, leaving me with
something I can diagnose.

Greg Wojtak
Unix Systems Administrator


AndrewStone said...

There's a small problem with the included code, because of an include being misinterpreted as a xml tag. Looking at the page source, it looks like you actually need:

#include < linux>

AndrewStone said...

Ok, I updated for 2.6 and tested on CentOS 5.0:

#include < linux/kernel.h >

extern int init_module(void);

int init_module (void)
panic(" panic has been called");
return 0;

#if 0
# Makefile to build on 2.6.X kernels
obj-m += panic.o

make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

neeko said...

I put a more complete post online at:

neeko said...




Creative Commons License
This work is licensed under a Creative Commons License.