Skip to content

Instantly share code, notes, and snippets.

@robshep
Last active May 1, 2020 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robshep/d965192329118ba7b7c906fd7952ce6b to your computer and use it in GitHub Desktop.
Save robshep/d965192329118ba7b7c906fd7952ce6b to your computer and use it in GitHub Desktop.
Rest on Panic

Don't listen to Corporal Jones

Build

make

Run

This isn't pretty, your computer and filesystems will hate you. Smoke may erupt. All your work WILL be lost.

echo 1 | sudo tee /proc/sys/kernel/panic
sudo insmod byebye.ko
#include <linux/module.h>
#include <linux/kernel.h>
static int __init seeya(void) {
char msg[0] = {};
panic(msg);
return 0;
}
module_init(seeya);
obj-m += byebye.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment