1 // https://github.com/google/sanitizers/issues/925
2 // RUN: %clang_hwasan -O0 %s -o %t && %run %t 2>&1
3 
4 // REQUIRES: aarch64-target-arch || x86_64-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/hwasan_interface.h>
12 
child()13 __attribute__((noinline, no_sanitize("hwaddress"))) void child() {
14   char x[10000];
15   __hwasan_tag_memory(x, 0xAA, sizeof(x));
16   _exit(0);
17 }
18 
parent()19 __attribute__((noinline, no_sanitize("hwaddress"))) void parent() {
20   char x[10000];
21   __hwasan_print_shadow(&x, sizeof(x));
22   assert(__hwasan_test_shadow(x, sizeof(x)) == -1);
23 }
24 
main(int argc,char ** argv)25 int main(int argc, char **argv) {
26   if (vfork())
27     parent();
28   else
29     child();
30 
31   return 0;
32 }
33