1 // RUN: %clangxx_hwasan -O0 %s -o %t && not %env_hwasan_opts=symbolize=0 %run %t 2>&1 | FileCheck %s --implicit-check-not=RETURN_FROM_TEST
2 // RUN: %clangxx_hwasan -O3 %s -o %t && not %env_hwasan_opts=symbolize=0 %run %t 2>&1 | FileCheck %s --implicit-check-not=RETURN_FROM_TEST
3 // RUN: %clangxx_hwasan -O0 %s -o %t && not %env_hwasan_opts=halt_on_error=0:symbolize=0 %run %t 2>&1 | FileCheck %s --implicit-check-not=RETURN_FROM_TEST --check-prefixes=CHECK,RECOVER
5 // UNSUPPORTED: android
14 #include <sanitizer/hwasan_interface.h>
15 #include <sanitizer/linux_syscall_hooks.h>
17 /* Test the presence of __sanitizer_syscall_ in the tool runtime, and general
18 sanity of their behaviour. */
20 int main(int argc
, char *argv
[]) {
21 // lit.cfg.py currently sets 'disable_allocator_tagging=1'
22 __hwasan_enable_allocator_tagging();
24 char *buf
= (char *)malloc(1000);
27 __sanitizer_syscall_pre_recvmsg(0, buf
- 1, 0);
28 // CHECK: HWAddressSanitizer: tag-mismatch on address [[PTR:0x[a-f0-9]+]]
29 // CHECK: Cause: heap-buffer-overflow
30 // CHECK: [[PTR]] is located 1 bytes before a 1000-byte region
33 fprintf(stderr
, "RETURN_FROM_TEST\n");
34 // RECOVER: RETURN_FROM_TEST