| 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 || riscv64-target-arch |
| 5 |
// REQUIRES: pointer-tagging |
| 6 |
|
| 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> |
| 13 |
|
| 14 |
__attribute__((noinline, no_sanitize("hwaddress"))) void child() { |
| 15 |
char x[10000]; |
| 16 |
__hwasan_tag_memory(x, 0xAA, sizeof(x)); |
| 17 |
_exit(0); |
| 18 |
} |
| 19 |
|
| 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); |
| 24 |
} |
| 25 |
|
| 26 |
int main(int argc, char **argv) { |
| 27 |
if (vfork()) |
| 28 |
parent(); |
| 29 |
else |
| 30 |
child(); |
| 31 |
|
| 32 |
return 0; |
| 33 |
} |