summary refs log tree commit diff
path: root/fail.c
diff options
context:
space:
mode:
Diffstat (limited to 'fail.c')
-rw-r--r--fail.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fail.c b/fail.c
index a08253a..90f6cb7 100644
--- a/fail.c
+++ b/fail.c
@@ -2,6 +2,7 @@
 
 #include <linux/seccomp.h>
 
+#include <sys/auxv.h>
 #include <sys/prctl.h>
 #include <sys/ptrace.h>
 #include <sys/stat.h>
@@ -20,6 +21,19 @@ segfault()
 	*nullp = 42;
 }
 
+void _start();
+
+__attribute__((__constructor__))
+void
+dlcrash()
+{
+	volatile int *nullp = 0;
+
+	// don't trigger if we are executed as a program
+	if (getauxval(AT_ENTRY) != (unsigned long)_start)
+		*nullp = 1337;
+}
+
 // can lockup your machine
 void
 oom()