1 // In a non-forking sandbox, we can't spawn an external symbolizer, but dladdr()
2 // should still work and provide function names. No line numbers though.
3 // Second, `atos` symbolizer can't inspect a process that has an inaccessible
4 // task port, in which case we should again fallback to dladdr gracefully.
6 // RUN: %clangxx_asan -O0 %s -o %t
7 // RUN: not %run sandbox-exec -p '(version 1)(allow default)(deny process-fork)' %t 2>&1 | FileCheck %s
8 // RUN: not %run sandbox-exec -p '(version 1)(allow default)(deny process-exec (literal "/usr/bin/atos"))' %t 2>&1 | FileCheck %s
9 // RUN: not %run sandbox-exec -p '(version 1)(allow default)(deny mach-priv-task-port)' %t 2>&1 | FileCheck %s
10 // RUN: env ASAN_SYMBOLIZER_PATH="" not %run sandbox-exec -p '(version 1)(allow default)(deny mach-priv-task-port)' %t 2>&1 | FileCheck %s
11 // RUN: %clangxx_asan -O3 %s -o %t
12 // RUN: not %run sandbox-exec -p '(version 1)(allow default)(deny process-fork)' %t 2>&1 | FileCheck %s
13 // RUN: not %run sandbox-exec -p '(version 1)(allow default)(deny process-exec (literal "/usr/bin/atos"))' %t 2>&1 | FileCheck %s
14 // RUN: not %run sandbox-exec -p '(version 1)(allow default)(deny mach-priv-task-port)' %t 2>&1 | FileCheck %s
15 // RUN: env ASAN_SYMBOLIZER_PATH="" not %run sandbox-exec -p '(version 1)(allow default)(deny mach-priv-task-port)' %t 2>&1 | FileCheck %s
17 // sandbox-exec isn't available on iOS
22 char *x
= (char*)malloc(10 * sizeof(char));
25 // CHECK: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}}
26 // CHECK: {{READ of size 1 at 0x.* thread T0}}
27 // CHECK: {{ #0 0x.* in main}}
28 // CHECK: {{freed by thread T0 here:}}
29 // CHECK: {{ #0 0x.* in free}}
30 // CHECK: {{ #1 0x.* in main}}
31 // CHECK: {{previously allocated by thread T0 here:}}
32 // CHECK: {{ #0 0x.* in malloc}}
33 // CHECK: {{ #1 0x.* in main}}