CRASHME(9)
π₯ CRASHME(9) β in-kernel testing of crash handling π₯
okay so this is the crashme page from the Kernel Developer's Manual, section 9, and bestieβ¦ it's literally a page about functions whose whole job is to break your kernel on purpose, so buckle up π’
β¨ NAME β¨
crashme, crashme_add, crashme_remove β in-kernel testing of crash handling π§¨
β¨ SYNOPSIS β¨
#include <sys/crashme.h>
int
crashme_add(crashme_node *cn);
int
crashme_remove(crashme_node *cn);
β¨ DESCRIPTION β¨
The crashme functions are how you dynamically add and remove crashme nodes π«Ά and like, a crashme node is lowkey just a named callback that's fully expected to make the system crash. yes bestie, that's the assignment. that's the whole vibe π
real talk though: thecrashmefunctionality is only available in kernels that have theoptions DEBUGset in the kernelconfig(5)file. no DEBUG, no crashing on purpose, periodt π ββοΈ
Every crashme node lives inside a crashme_node structure, and it's giving these public members:
typedef int (*crashme_fn)(int /* flags */);
typedef struct crashme_node {
const char *cn_name;
const char *cn_longname;
crashme_fn cn_fn;
} crashme_node;
The caller must fill in cn_name, cn_longname, and cn_fn β no skipping, not optional, main character energy only π
The cn_fn function gets passed the flags parameter straight from sysctl. It shall return 0 upon success, or non zero on failure. simple as that π
β¨ SYSCTL SUPPORT β¨
The crashme subsystem provides these sysctl(8) variables:
debug.crashme_enableβ must be set to1for any crashme node to be executed. it's the master switch bestie, nothing happens without it π
And these sysctl(8) variables literally trigger crashes in different ways when you write to them π:
debug.crashme.panicβ callspanic(9)π₯debug.crashme.null_derefβ dereferences a null pointer π³οΈdebug.crashme.null_jumpβ calls a null function pointer, i.e. jumps to the instruction address zero πdebug.crashme.ddbβ entersddb(4)directly by callingDebugger(). this one requiresoptions DDBπͺ²
ngl these are all extremely on purpose. that's the point. don't be surprised when the box goes down, that's the whole slay π
β¨ SEE ALSO β¨
ddb(4), options(4), sysctl(8), panic(9) πΈ
β¨ HISTORY β¨
The crashme driver appeared in NetBSD 9.0 β
β¨ AUTHORS β¨
Matthew R. Green π«Ά
and that's the page, bestie!! π this rewrite is from the Debian version, dated January 7, 2019 β mwah, go crash something responsibly (in a DEBUG kernel) ππ¦
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2019 Matthew R. Green
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms