[clug] Causing a kernel oops

Darren Freeman daz111 at rsphysse.anu.edu.au
Tue Sep 2 14:54:23 EST 2003

On Tue, 2003-09-02 at 13:08, Andrew Pollock wrote:
> Hi,
> One of my colleagues was reading a security advisory about something that 
> caused a kernel oops, and asked what a kernel oops was.

It's what you get to remind you that you're on the bleeding-edge most
modern OS in the world ;)

> I seem to recall reading somewhere in the past (Bugtraq) about a test 
> kernel module you could insert into a kernel that would cause an oops. I

Wouldn't surprise me ;) I've generated a few by accident so it can't be
that hard.

> believe there's actually a system call or something to do it, but I don't 
> know the specifics, and I can't find a reference with Google (I drown in 
> bug reports no matter how I word my query).
> Does anyone more in the know with kernel internals than I either know how 
> to bang up a module that will cause a kernel oops, or know of the module 
> source I'm referring to?

Get the free as in freedom book from the O'Reilly website, called "linux
Device Drivers" second edition, I forget the author's name.

It's a fantastic book to read even if you aren't going to write a kernel
module. But following the examples you really feel nice about your
kernel ;)

The macro OOPS() is what causes an oops. Surprise surprise ;)

You just need a module with the ability to be loaded and call OOPS() in
init(). Then insmod will oops when trying to load it. I forget the
particulars, maybe it will kill insmod in the process, but that's fun
too. You can probably get an oops too if you dereference a null poiner
from kernel space, but if you're not attached to a user process I forget
how bad that can get - panic possibly. It's been a while and I was
careful not to generate stuff like that.

> Just want to demonstrate an oops on my PC.

You can probably just add an OOPS() to a module you won't be needing,
like some tape drive or something. Then compile it and insmod it.

> Thanks
> Andrew


More information about the linux mailing list