summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/asan/TestCases/Linux/vfork.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/test/asan/TestCases/Linux/vfork.cc')
-rw-r--r--compiler-rt/test/asan/TestCases/Linux/vfork.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/compiler-rt/test/asan/TestCases/Linux/vfork.cc b/compiler-rt/test/asan/TestCases/Linux/vfork.cc
new file mode 100644
index 00000000000..6e52fbbaa7f
--- /dev/null
+++ b/compiler-rt/test/asan/TestCases/Linux/vfork.cc
@@ -0,0 +1,31 @@
+// https://github.com/google/sanitizers/issues/925
+// RUN: %clang_asan -O0 %s -o %t && %run %t 2>&1
+
+// REQUIRES: aarch64-android-target-arch
+
+#include <assert.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sanitizer/asan_interface.h>
+
+__attribute__((noinline, no_sanitize("address"))) void child() {
+ char x[10000];
+ __asan_poison_memory_region(x, sizeof(x));
+ _exit(0);
+}
+
+__attribute__((noinline, no_sanitize("address"))) void parent() {
+ char x[10000];
+ assert(__asan_address_is_poisoned(x + 5000) == 0);
+}
+
+int main(int argc, char **argv) {
+ if (vfork())
+ parent();
+ else
+ child();
+
+ return 0;
+}
OpenPOWER on IntegriCloud