1 // https://github.com/google/sanitizers/issues/925
2 // RUN: %clang_asan -O0 %s -o %t && %run %t 2>&1
3 
4 // REQUIRES: aarch64-target-arch || x86_64-target-arch || i386-target-arch || arm-target-arch || riscv64-target-arch
5 
6 #include <assert.h>
7 #include <sys/types.h>
8 #include <sys/wait.h>
9 #include <unistd.h>
10 #include <stdio.h>
11 #include <sanitizer/asan_interface.h>
12 
child()13 __attribute__((noinline, no_sanitize("address"))) void child() {
14   alignas(8) char x[100000];
15   __asan_poison_memory_region(x, sizeof(x));
16   _exit(0);
17 }
18 
parent()19 __attribute__((noinline, no_sanitize("address"))) void parent() {
20   alignas(8) char x[100000];
21   assert(__asan_address_is_poisoned(x + 5000) == 0);
22 }
23 
main(int argc,char ** argv)24 int main(int argc, char **argv) {
25   if (vfork())
26     parent();
27   else
28     child();
29 
30   return 0;
31 }
32