A module for crashing the kernel
Simon Kagstrom has heard the pain expressed by such users; in response, he has posted a kernel module just for people who want to be able to destroy their systems on demand. This module creates a directory (provoke_crash) in debugfs, filled with a number of useful files. For those with simple needs, a write to bugon results in a straightforward BUG() call. Users with more discriminating tastes can write to null_dereference to cause a null pointer dereference, overwrite_allocation to write beyond a heap allocation, or corrupt_stack to overwrite the stack. And truly kinky users can go for oops_interrupt_context to get a null dereference in softirq mode, write_after_free to step on freed memory, or unaligned_load_store to perform badly-aligned memory operations.
Needless to say, this isn't a module one would ordinarily want to leave
loaded into a production system; it's better kept in a secret place and
pulled out after the kids go to sleep. Unless, of course, you have a real
use for it; Simon has been employing it to make sure that kmsg_dump() does the
right thing in various crash scenarios. For most developers, though, work
is normally dominated by the need to avoid crashes; since they'll
have little use for this feature, it's not clear that this little module
will ever make its way into the mainline.
| Index entries for this article | |
|---|---|
| Kernel | Development tools |
