about summary refs log tree commit diff
path: root/fail.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-07-31 16:16:02 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-07-31 16:18:16 +0200
commit6efb555132586352958e2d91bc6ec06444ac7c3d (patch)
tree614b01691af1b174f0c60106bb96357198fb22b5 /fail.c
parent22d7580b77beef5ca4311c6da9d7562a6ce73ee0 (diff)
downloadfail-6efb555132586352958e2d91bc6ec06444ac7c3d.tar.gz
fail-6efb555132586352958e2d91bc6ec06444ac7c3d.tar.xz
fail-6efb555132586352958e2d91bc6ec06444ac7c3d.zip
crash on dlopen v0.1
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()