KFunc crash_kexec
Crash the kernel at a specific point in the code.
Definition
void crash_kexec(struct pt_regs *regs)
Warning
This kfunc is destructive to the system. For example such a call can result in system rebooting or panicking.
Due to this additional restrictions apply to these calls. At the moment they only require CAP_SYS_BOOT
capability,
but more can be added later.
Usage
eBPF is often used for kernel debugging, and one of the widely used and powerful debugging techniques is postmortem debugging with a full memory dump.
This kfunc allows to trigger a kernel panic at a specific point in the kernels execution, this allows for the inspection of the memory dump at the exact point a program detected a certain condition.
Program types
The following program types can make use of this kfunc:
BPF_PROG_TYPE_LSM
BPF_PROG_TYPE_SCHED_CLS
BPF_PROG_TYPE_STRUCT_OPS
BPF_PROG_TYPE_TRACING
BPF_PROG_TYPE_XDP
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome