brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · bb94aa1 Raw
33 lines · c
1// RUN: %clang_hwasan %s -o %t && %env_hwasan_opts=print_module_map=1 %run %t 2>&1 | FileCheck %s --check-prefixes=EXIT,NOMORE2// RUN: %clang_hwasan %s -DBUG -o %t && %env_hwasan_opts=print_module_map=1 not %run %t 2>&1 | FileCheck %s --check-prefixes=EXIT,NOMORE3// RUN: %clang_hwasan %s -DBUG -fsanitize-recover=hwaddress -o %t && %env_hwasan_opts=print_module_map=1,halt_on_error=0 not %run %t 2>&1 | FileCheck %s --check-prefixes=EXIT,NOMORE4// RUN: %clang_hwasan %s -DBUG -fsanitize-recover=hwaddress -o %t && %env_hwasan_opts=print_module_map=2,halt_on_error=0 not %run %t 2>&1 | FileCheck %s --check-prefixes=BUG1,BUG2,EXIT,NOMORE5 6#include <stdlib.h>7#include <stdio.h>8#include <sanitizer/hwasan_interface.h>9 10int main() {11  __hwasan_enable_allocator_tagging();12#ifdef BUG13  char * volatile x = (char*)malloc(40);14  free(x);15  free(x);16  free(x);17#endif18  __hwasan_disable_allocator_tagging();19  // BUG1: Process memory map follows:20  // BUG1: print-module-map21  // BUG1: End of process memory map.22 23  // BUG2: Process memory map follows:24  // BUG2: print-module-map25  // BUG2: End of process memory map.26 27  // EXIT: Process memory map follows:28  // EXIT: print-module-map29  // EXIT: End of process memory map.30 31  // NOMORE-NOT: Process memory map follows:32}33