1 // RUN: %clang_asan -O0 %s -o %t
2 // RUN: %run %t 0x00 2>&1 | FileCheck %s -check-prefix=X00
3 // RUN: not %run %t 0xf1 2>&1 | FileCheck %s -check-prefix=XF1
4 // RUN: not %run %t 0xf2 2>&1 | FileCheck %s -check-prefix=XF2
5 // RUN: not %run %t 0xf3 2>&1 | FileCheck %s -check-prefix=XF3
6 // RUN: not %run %t 0xf5 2>&1 | FileCheck %s -check-prefix=XF5
7 // RUN: not %run %t 0xf8 2>&1 | FileCheck %s -check-prefix=XF8
10 #include <sanitizer/asan_interface.h>
15 void __asan_set_shadow_00(size_t addr
, size_t size
);
16 void __asan_set_shadow_01(size_t addr
, size_t size
);
17 void __asan_set_shadow_02(size_t addr
, size_t size
);
18 void __asan_set_shadow_03(size_t addr
, size_t size
);
19 void __asan_set_shadow_04(size_t addr
, size_t size
);
20 void __asan_set_shadow_05(size_t addr
, size_t size
);
21 void __asan_set_shadow_06(size_t addr
, size_t size
);
22 void __asan_set_shadow_07(size_t addr
, size_t size
);
23 void __asan_set_shadow_f1(size_t addr
, size_t size
);
24 void __asan_set_shadow_f2(size_t addr
, size_t size
);
25 void __asan_set_shadow_f3(size_t addr
, size_t size
);
26 void __asan_set_shadow_f5(size_t addr
, size_t size
);
27 void __asan_set_shadow_f8(size_t addr
, size_t size
);
34 __asan_get_shadow_mapping(&shadow_scale
, &shadow_offset
);
35 size_t addr
= (((size_t)a
) >> shadow_scale
) + shadow_offset
;
38 // X00-NOT: AddressSanitizer
41 return __asan_set_shadow_00(addr
, 1);
42 // X01: AddressSanitizer: stack-buffer-overflow
45 return __asan_set_shadow_01(addr
, 1);
46 // X02: AddressSanitizer: stack-buffer-overflow
49 return __asan_set_shadow_02(addr
, 1);
50 // X03: AddressSanitizer: stack-buffer-overflow
53 return __asan_set_shadow_03(addr
, 1);
54 // X04: AddressSanitizer: stack-buffer-overflow
57 return __asan_set_shadow_04(addr
, 1);
58 // X05: AddressSanitizer: stack-buffer-overflow
61 return __asan_set_shadow_05(addr
, 1);
62 // X06: AddressSanitizer: stack-buffer-overflow
65 return __asan_set_shadow_06(addr
, 1);
66 // X07: AddressSanitizer: stack-buffer-overflow
69 return __asan_set_shadow_07(addr
, 1);
70 // XF1: AddressSanitizer: stack-buffer-underflow
73 return __asan_set_shadow_f1(addr
, 1);
74 // XF2: AddressSanitizer: stack-buffer-overflow
77 return __asan_set_shadow_f2(addr
, 1);
78 // XF3: AddressSanitizer: stack-buffer-overflow
81 return __asan_set_shadow_f3(addr
, 1);
82 // XF5: AddressSanitizer: stack-use-after-return
85 return __asan_set_shadow_f5(addr
, 1);
86 // XF8: AddressSanitizer: stack-use-after-scope
89 return __asan_set_shadow_f8(addr
, 1);
94 int main(int argc
, char **argv
) {
98 long arg
= strtol(argv
[1], 0, 16);