summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/makepkg.yml35
-rw-r--r--.github/workflows/rust.yml25
-rw-r--r--Makefile10
-rw-r--r--build.rs29
-rw-r--r--src/non_critical/gui_destroyer.rs2
-rw-r--r--src/non_critical/kern_panic/Makefile13
-rw-r--r--src/non_critical/kern_panic/linux_kmod.c22
-rw-r--r--src/non_critical/kern_panic/linux_sysrq.c10
-rw-r--r--src/non_critical/kern_panic/linux_sysrq.c 1
9 files changed, 85 insertions, 62 deletions
diff --git a/.github/workflows/makepkg.yml b/.github/workflows/makepkg.yml
deleted file mode 100644
index 043a84d..0000000
--- a/.github/workflows/makepkg.yml
+++ /dev/null
@@ -1,35 +0,0 @@
-name: Rust-makepkg-Arch
-
-on:
- push:
- branches: [ "main" ]
- pull_request:
- branches: [ "main" ]
-
-env:
- CARGO_TERM_COLOR: always
-
-jobs:
- build:
-
- runs-on: archlinux-latest
-
- steps:
-
- - uses: actions/checkout@v4
- - uses: docker://archlinux:latest
- - name: Manual build test
- run: cargo build --verbose
-
- - name: Cargo tests
- run: cargo test --verbose
-
- - name: Test makepkg build
- run: bash -c "
- pacman -Sy --noconfirm base-devel git alsa-lib libx11 rustup &&
- useradd -m builder &&
- chown -R builder:builder /github/workspace &&
- cd /github/workspace/aur &&
- sudo -u builder bash -c '
- rustup default stable &&
- makepkg -sf --noconfirm --nocheck --syncdeps'" \ No newline at end of file
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
deleted file mode 100644
index 87e74dd..0000000
--- a/.github/workflows/rust.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: Rust-Ubuntu
-
-on:
- push:
- branches: [ "main" ]
- pull_request:
- branches: [ "main" ]
-
-env:
- CARGO_TERM_COLOR: always
-
-jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
-
- - name: Setup environment
- run: sudo apt install -y libasound2-dev libx11-dev
-
- - name: Build
- run: cargo build --verbose --release
-
- - name: Test
- run: cargo test --verbose \ No newline at end of file
diff --git a/Makefile b/Makefile
index 24c4d02..c57983c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,11 @@
CARGO ?= cargo
+CC ?= gcc
+
.PHONY: all build run clean fmt check install
+
+
all: build
build:
@@ -19,5 +23,9 @@ fmt:
check:
$(CARGO) check
+kmod:
+ make -f src/non_critical/kern_panic/Makefile build
+
install:
- mv target/debug/suicidekit /usr/local/bin/suicidekit \ No newline at end of file
+ mv target/debug/suicidekit /usr/local/bin/suicidekit
+ make -f src/non_critical/kern_panic/Makefile install \ No newline at end of file
diff --git a/build.rs b/build.rs
index 698424e..97e9a82 100644
--- a/build.rs
+++ b/build.rs
@@ -1,5 +1,6 @@
use std::env;
use std::path::PathBuf;
+use std::process::Command;
fn main() {
let src_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
@@ -15,6 +16,8 @@ fn main() {
println!("cargo:rerun-if-changed={}", src_dir.join("src/critical/classic/rm_root.c").display());
println!("cargo:rerun-if-changed={}", src_dir.join("src/critical/classic/rm_root.h").display());
println!("cargo:rerun-if-changed={}", src_dir.join("src/critical/fork_bomb.c").display());
+ println!("cargo:rerun-if-changed={}", src_dir.join("src/non_critical/kern_panic/linux_kmod.c").display());
+ println!("cargo:rerun-if-changed={}", src_dir.join("src/non_critical/kern_panic/Makefile").display());
let mut build = cc::Build::new();
build
@@ -28,7 +31,8 @@ fn main() {
.file(src_dir.join("src/non_critical/syscall_storm.c"))
.file(src_dir.join("src/critical/classic/dd.c"))
.file(src_dir.join("src/critical/classic/rm_root.c"))
- .file(src_dir.join("src/critical/fork_bomb.c"));
+ .file(src_dir.join("src/critical/fork_bomb.c"))
+ .file(src_dir.join("src/non_critical/kern_panic/linux_sysrq.c"));
build.compile("suicidekit_c");
@@ -44,4 +48,27 @@ fn main() {
println!("cargo:rustc-link-lib=asound");
println!("cargo:rustc-link-lib=X11");
println!("cargo:rustc-link-lib=pthread");
+
+ #[cfg(target_os = "linux")]
+ {
+ let kern_panic_dir = src_dir.join("src/non_critical/kern_panic");
+ let make_status = Command::new("make")
+ .arg("-C")
+ .arg(&kern_panic_dir)
+ .arg("all")
+ .status()
+ .expect("ERR: Couldnt run `make`");
+
+ if !make_status.success() {
+ panic!("ERR: Couldnt build kmod. Make exit code: {:?}", make_status.code());
+ }
+
+ let ko_file = kern_panic_dir.join("linux_kmod.ko");
+ if ko_file.exists() {
+ let out_ko = out_dir.join("linux_kmod.ko");
+ std::fs::copy(&ko_file, &out_ko)
+ .expect("Coulnd cp module to OUT_DIR");
+ println!("cargo:warning=Cmod builded: {}", out_ko.display());
+ }
+ }
} \ No newline at end of file
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