[compiler-rt][rtsan] inotify api for Linux interception. (#124177)
[llvm-project.git] / compiler-rt / test / hwasan / TestCases / Linux / vfork.c
blob3ab0ce97202fd77363ec623e5bde095767b4eb4d
1 // https://github.com/google/sanitizers/issues/925
2 // RUN: %clang_hwasan -O0 %s -o %t && %run %t 2>&1
4 // REQUIRES: aarch64-target-arch || x86_64-target-arch || riscv64-target-arch
5 // REQUIRES: pointer-tagging
7 #include <assert.h>
8 #include <sys/types.h>
9 #include <sys/wait.h>
10 #include <unistd.h>
11 #include <stdio.h>
12 #include <sanitizer/hwasan_interface.h>
14 __attribute__((noinline, no_sanitize("hwaddress"))) void child() {
15 char x[10000];
16 __hwasan_tag_memory(x, 0xAA, sizeof(x));
17 _exit(0);
20 __attribute__((noinline, no_sanitize("hwaddress"))) void parent() {
21 char x[10000];
22 __hwasan_print_shadow(&x, sizeof(x));
23 assert(__hwasan_test_shadow(x, sizeof(x)) == -1);
26 int main(int argc, char **argv) {
27 if (vfork())
28 parent();
29 else
30 child();
32 return 0;