diff options
| author | Namilskyy <alive6863@gmail.com> | 2025-11-05 21:45:40 +0300 |
|---|---|---|
| committer | Namilskyy <alive6863@gmail.com> | 2025-11-05 21:45:40 +0300 |
| commit | 1f36c1d58db4423dc09d8408897dbb507026f89b (patch) | |
| tree | 5cb2be2a74774906496f74a51b01f794937519d3 /src/non_critical | |
| parent | 697352a7cba6bbcc6603f02327a9f5f5f90bd393 (diff) | |
Added kernel panic layer
Diffstat (limited to 'src/non_critical')
| -rw-r--r-- | src/non_critical/gui_destroyer.rs | 2 | ||||
| -rw-r--r-- | src/non_critical/kern_panic/Makefile | 13 | ||||
| -rw-r--r-- | src/non_critical/kern_panic/linux_kmod.c | 22 | ||||
| -rw-r--r-- | src/non_critical/kern_panic/linux_sysrq.c | 10 | ||||
| -rw-r--r-- | src/non_critical/kern_panic/linux_sysrq.c | 1 |
5 files changed, 48 insertions, 0 deletions
diff --git a/src/non_critical/gui_destroyer.rs b/src/non_critical/gui_destroyer.rs index 0286298..126f0a6 100644 --- a/src/non_critical/gui_destroyer.rs +++ b/src/non_critical/gui_destroyer.rs @@ -91,6 +91,8 @@ unsafe fn artifacts_x11() -> xlib::Window { win } + +// WARNING: Compositor can deny the request, big compositors like kwin_wl will deny the request fn wayland_corrupt_buffer() -> Result<(), Box<dyn Error>> { let display = Display::connect_to_env()?; let mut event_queue = display.create_event_queue(); diff --git a/src/non_critical/kern_panic/Makefile b/src/non_critical/kern_panic/Makefile new file mode 100644 index 0000000..9b4a328 --- /dev/null +++ b/src/non_critical/kern_panic/Makefile @@ -0,0 +1,13 @@ +obj-m += linux_kmod.o + +KDIR ?= /lib/modules/$(shell uname -r)/build +PWD := $(dir $(abspath $(firstword $(MAKEFILE_LIST)))) + +all: + $(MAKE) -C $(KDIR) M=$(PWD) modules + +clean: + $(MAKE) -C $(KDIR) M=$(PWD) clean + +.PHONY: all clean + diff --git a/src/non_critical/kern_panic/linux_kmod.c b/src/non_critical/kern_panic/linux_kmod.c new file mode 100644 index 0000000..ae0494d --- /dev/null +++ b/src/non_critical/kern_panic/linux_kmod.c @@ -0,0 +1,22 @@ +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/delay.h> + +static int __init cr_init(void) { + printk(KERN_INFO "Crash module loaded, your kernel will broke in \n"); + for(int i = 0; i < 10; i++) { + ssleep(1); + printk(KERN_INFO "%d\n", i); + } + *(int*)0 = 0xdeadbeef; + return 0; +} + +static void __exit cr_exit(void) { + printk(KERN_INFO "Crash module unloaded((((\n"); + printk(KERN_INFO "It's not a bug, it's a feature. Were just wanted to write dump to 0 addr.\n"); +} + +module_init(cr_init); +module_exit(cr_exit); +MODULE_LICENSE("BSD-2-CLAUSE");
\ No newline at end of file diff --git a/src/non_critical/kern_panic/linux_sysrq.c b/src/non_critical/kern_panic/linux_sysrq.c new file mode 100644 index 0000000..b609043 --- /dev/null +++ b/src/non_critical/kern_panic/linux_sysrq.c @@ -0,0 +1,10 @@ +#include <stdio.h> +#include <stdlib.h> + +void linux_sysrq_start() { + system("echo 1 > /proc/sys/kernel/sysrq"); +} + +void linux_sysrq_panic() { + system("echo 1 > /proc/sysrq-trigger"); +}
\ No newline at end of file diff --git a/src/non_critical/kern_panic/linux_sysrq.c b/src/non_critical/kern_panic/linux_sysrq.c new file mode 100644 index 0000000..c85f12c --- /dev/null +++ b/src/non_critical/kern_panic/linux_sysrq.c @@ -0,0 +1 @@ +#include <
\ No newline at end of file |
