Fengwei Zhang
Fengwei Zhang

Reputation: 1027

Crash a kernel on purpose

Is there any way I can crash a kernel on purpose (e.g., kernel panic, blue screen, black screen, or whatever). Assume I can change any registers and have administrative privilege of the system. I would like to demonstrate this on both Windows and Linux platforms.

Thanks for any inputs!

Upvotes: 2

Views: 1935

Answers (3)

askb
askb

Reputation: 6768

There are several ways to do this:

  1. Write your own kernel module and load it, make sure you call BUG() or BUG_ON().
  2. Use sysrq; echo c > /proc/sysrq-trigger, with this make sure to install kdump if you are interested in capturing a vmcore file.

Upvotes: 2

CL.
CL.

Reputation: 180010

In Linux, you must compile the kernel with the CONFIG_MAGIC_SYSRQ option, then you can crash the kernel by writing the crash command into /proc/sysrq-trigger, or by pressing Alt+SysRq+C. See the documentation for details.

In Windows, you must set the CrashOnCtrlScroll registry key for the keyboard driver, and reboot, then you can press Ctrl+Scroll Lock to crash the kernel. See the documentation for details.

Upvotes: 2

Sun
Sun

Reputation: 1581

echo c > proc/sysrq-trigger

Upvotes: 2

Related Questions