brintos

brintos / llvm-project-archived public Read only

0
0
Text · 776 B · 3ab0ce9 Raw
34 lines · c
1// https://github.com/google/sanitizers/issues/9252// RUN: %clang_hwasan -O0 %s -o %t && %run %t 2>&13 4// REQUIRES: aarch64-target-arch || x86_64-target-arch || riscv64-target-arch5// REQUIRES: pointer-tagging6 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 26int main(int argc, char **argv) {27  if (vfork())28    parent();29  else30    child();31 32  return 0;33}34