diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-07-31 13:31:59 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-07-31 13:31:59 +0200 |
commit | ffce461534d8cf7d61c11a1df3a417d5a3ef1dcb (patch) | |
tree | 7dc2e21148f7a2937221bda034351d97b914965f | |
parent | 8bc6a711fbbad02abcf98f441330be19627ce3a0 (diff) | |
download | fail-ffce461534d8cf7d61c11a1df3a417d5a3ef1dcb.tar.gz fail-ffce461534d8cf7d61c11a1df3a417d5a3ef1dcb.tar.xz fail-ffce461534d8cf7d61c11a1df3a417d5a3ef1dcb.zip |
formatting
-rw-r--r-- | fail.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/fail.c b/fail.c index 36896c5..4984e33 100644 --- a/fail.c +++ b/fail.c @@ -13,7 +13,8 @@ #include <unistd.h> void -segfault() { +segfault() +{ volatile int *nullp = 0; *nullp = 42; @@ -21,7 +22,8 @@ segfault() { // can lockup your machine void -oom() { +oom() +{ long c = 0; static long last = 0; @@ -40,7 +42,8 @@ oom() { } void -recurse(char *n) { +recurse(char *n) +{ char m[1024]; recurse(m); if (n) @@ -48,16 +51,19 @@ recurse(char *n) { } void -abortme() { +abortme() +{ abort(); } void -killme() { +killme() +{ raise(SIGKILL); } -void illegalins() { +void illegalins() +{ #if defined(__x86_64__) || defined(__i386__) __asm__ __volatile__( "ud1" : : : "memory" ); #elif defined(__arm__) @@ -75,23 +81,27 @@ void illegalins() { #endif } -void trap() { +void trap() +{ __builtin_trap(); } int zero = 0; -void divtrap() { +void divtrap() +{ zero = 1/zero; } void -violate_seccomp() { +violate_seccomp() +{ prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT); chdir("/"); } int -main(int argc, char *argv[]) { +main(int argc, char *argv[]) +{ int c; while ((c = getopt(argc, argv, "123Oacdikrst")) != -1) { |