xref: /freebsd-src/contrib/llvm-project/compiler-rt/lib/asan_abi/asan_abi_shim.cpp (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
106c3fb27SDimitry Andric //===-asan_abi_shim.cpp - ASan Stable ABI Shim-----------------------------===//
206c3fb27SDimitry Andric //
306c3fb27SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
406c3fb27SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
506c3fb27SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
606c3fb27SDimitry Andric //
706c3fb27SDimitry Andric //===----------------------------------------------------------------------===//
806c3fb27SDimitry Andric 
906c3fb27SDimitry Andric #include "../asan/asan_interface_internal.h"
1006c3fb27SDimitry Andric #include "asan_abi.h"
1106c3fb27SDimitry Andric #include <assert.h>
1206c3fb27SDimitry Andric 
1306c3fb27SDimitry Andric extern "C" {
1406c3fb27SDimitry Andric // Functions concerning instrumented global variables
1506c3fb27SDimitry Andric void __asan_register_image_globals(uptr *flag) {
1606c3fb27SDimitry Andric   __asan_abi_register_image_globals();
1706c3fb27SDimitry Andric }
1806c3fb27SDimitry Andric void __asan_unregister_image_globals(uptr *flag) {
1906c3fb27SDimitry Andric   __asan_abi_unregister_image_globals();
2006c3fb27SDimitry Andric }
215f757f3fSDimitry Andric void __asan_register_elf_globals(uptr *flag, void *start, void *stop) {
225f757f3fSDimitry Andric   bool bFlag = *flag;
235f757f3fSDimitry Andric   __asan_abi_register_elf_globals(&bFlag, start, stop);
245f757f3fSDimitry Andric   *flag = bFlag;
255f757f3fSDimitry Andric }
265f757f3fSDimitry Andric void __asan_unregister_elf_globals(uptr *flag, void *start, void *stop) {
275f757f3fSDimitry Andric   bool bFlag = *flag;
285f757f3fSDimitry Andric   __asan_abi_unregister_elf_globals(&bFlag, start, stop);
295f757f3fSDimitry Andric   *flag = bFlag;
305f757f3fSDimitry Andric }
315f757f3fSDimitry Andric void __asan_register_globals(__asan_global *globals, uptr n) {
325f757f3fSDimitry Andric   __asan_abi_register_globals(globals, n);
335f757f3fSDimitry Andric }
345f757f3fSDimitry Andric void __asan_unregister_globals(__asan_global *globals, uptr n) {
355f757f3fSDimitry Andric   __asan_abi_unregister_globals(globals, n);
365f757f3fSDimitry Andric }
3706c3fb27SDimitry Andric 
3806c3fb27SDimitry Andric // Functions concerning dynamic library initialization
3906c3fb27SDimitry Andric void __asan_before_dynamic_init(const char *module_name) {
4006c3fb27SDimitry Andric   __asan_abi_before_dynamic_init(module_name);
4106c3fb27SDimitry Andric }
4206c3fb27SDimitry Andric void __asan_after_dynamic_init(void) { __asan_abi_after_dynamic_init(); }
4306c3fb27SDimitry Andric 
4406c3fb27SDimitry Andric // Functions concerning block memory destinations
4506c3fb27SDimitry Andric void *__asan_memcpy(void *dst, const void *src, uptr size) {
4606c3fb27SDimitry Andric   return __asan_abi_memcpy(dst, src, size);
4706c3fb27SDimitry Andric }
4806c3fb27SDimitry Andric void *__asan_memset(void *s, int c, uptr n) {
4906c3fb27SDimitry Andric   return __asan_abi_memset(s, c, n);
5006c3fb27SDimitry Andric }
5106c3fb27SDimitry Andric void *__asan_memmove(void *dest, const void *src, uptr n) {
5206c3fb27SDimitry Andric   return __asan_abi_memmove(dest, src, n);
5306c3fb27SDimitry Andric }
5406c3fb27SDimitry Andric 
5506c3fb27SDimitry Andric // Functions concerning RTL startup and initialization
5606c3fb27SDimitry Andric void __asan_init(void) {
57*0fca6ea1SDimitry Andric   static_assert(sizeof(uptr) == 8 || sizeof(uptr) == 4);
5806c3fb27SDimitry Andric   static_assert(sizeof(u64) == 8);
5906c3fb27SDimitry Andric   static_assert(sizeof(u32) == 4);
6006c3fb27SDimitry Andric 
6106c3fb27SDimitry Andric   __asan_abi_init();
6206c3fb27SDimitry Andric }
635f757f3fSDimitry Andric 
6406c3fb27SDimitry Andric void __asan_handle_no_return(void) { __asan_abi_handle_no_return(); }
6506c3fb27SDimitry Andric 
6606c3fb27SDimitry Andric // Variables concerning RTL state. These provisionally exist for completeness
6706c3fb27SDimitry Andric // but will likely move into the Stable ABI implementation and not in the shim.
685f757f3fSDimitry Andric uptr __asan_shadow_memory_dynamic_address = (uptr)0L;
695f757f3fSDimitry Andric int __asan_option_detect_stack_use_after_return = 1;
7006c3fb27SDimitry Andric 
7106c3fb27SDimitry Andric // Functions concerning memory load and store reporting
7206c3fb27SDimitry Andric void __asan_report_load1(uptr addr) {
7306c3fb27SDimitry Andric   __asan_abi_report_load_n((void *)addr, 1, true);
7406c3fb27SDimitry Andric }
7506c3fb27SDimitry Andric void __asan_report_load2(uptr addr) {
7606c3fb27SDimitry Andric   __asan_abi_report_load_n((void *)addr, 2, true);
7706c3fb27SDimitry Andric }
7806c3fb27SDimitry Andric void __asan_report_load4(uptr addr) {
7906c3fb27SDimitry Andric   __asan_abi_report_load_n((void *)addr, 4, true);
8006c3fb27SDimitry Andric }
8106c3fb27SDimitry Andric void __asan_report_load8(uptr addr) {
8206c3fb27SDimitry Andric   __asan_abi_report_load_n((void *)addr, 8, true);
8306c3fb27SDimitry Andric }
8406c3fb27SDimitry Andric void __asan_report_load16(uptr addr) {
8506c3fb27SDimitry Andric   __asan_abi_report_load_n((void *)addr, 16, true);
8606c3fb27SDimitry Andric }
8706c3fb27SDimitry Andric void __asan_report_load_n(uptr addr, uptr size) {
8806c3fb27SDimitry Andric   __asan_abi_report_load_n((void *)addr, size, true);
8906c3fb27SDimitry Andric }
9006c3fb27SDimitry Andric void __asan_report_store1(uptr addr) {
9106c3fb27SDimitry Andric   __asan_abi_report_store_n((void *)addr, 1, true);
9206c3fb27SDimitry Andric }
9306c3fb27SDimitry Andric void __asan_report_store2(uptr addr) {
9406c3fb27SDimitry Andric   __asan_abi_report_store_n((void *)addr, 2, true);
9506c3fb27SDimitry Andric }
9606c3fb27SDimitry Andric void __asan_report_store4(uptr addr) {
9706c3fb27SDimitry Andric   __asan_abi_report_store_n((void *)addr, 4, true);
9806c3fb27SDimitry Andric }
9906c3fb27SDimitry Andric void __asan_report_store8(uptr addr) {
10006c3fb27SDimitry Andric   __asan_abi_report_store_n((void *)addr, 8, true);
10106c3fb27SDimitry Andric }
10206c3fb27SDimitry Andric void __asan_report_store16(uptr addr) {
10306c3fb27SDimitry Andric   __asan_abi_report_store_n((void *)addr, 16, true);
10406c3fb27SDimitry Andric }
10506c3fb27SDimitry Andric void __asan_report_store_n(uptr addr, uptr size) {
10606c3fb27SDimitry Andric   __asan_abi_report_store_n((void *)addr, size, true);
10706c3fb27SDimitry Andric }
10806c3fb27SDimitry Andric 
10906c3fb27SDimitry Andric // Functions concerning memory load and store reporting (experimental variants)
11006c3fb27SDimitry Andric void __asan_report_exp_load1(uptr addr, u32 exp) {
11106c3fb27SDimitry Andric   __asan_abi_report_exp_load_n((void *)addr, exp, 1, true);
11206c3fb27SDimitry Andric }
11306c3fb27SDimitry Andric void __asan_report_exp_load2(uptr addr, u32 exp) {
11406c3fb27SDimitry Andric   __asan_abi_report_exp_load_n((void *)addr, exp, 2, true);
11506c3fb27SDimitry Andric }
11606c3fb27SDimitry Andric void __asan_report_exp_load4(uptr addr, u32 exp) {
11706c3fb27SDimitry Andric   __asan_abi_report_exp_load_n((void *)addr, exp, 4, true);
11806c3fb27SDimitry Andric }
11906c3fb27SDimitry Andric void __asan_report_exp_load8(uptr addr, u32 exp) {
12006c3fb27SDimitry Andric   __asan_abi_report_exp_load_n((void *)addr, exp, 8, true);
12106c3fb27SDimitry Andric }
12206c3fb27SDimitry Andric void __asan_report_exp_load16(uptr addr, u32 exp) {
12306c3fb27SDimitry Andric   __asan_abi_report_exp_load_n((void *)addr, exp, 16, true);
12406c3fb27SDimitry Andric }
12506c3fb27SDimitry Andric void __asan_report_exp_load_n(uptr addr, uptr size, u32 exp) {
12606c3fb27SDimitry Andric   __asan_abi_report_exp_load_n((void *)addr, size, exp, true);
12706c3fb27SDimitry Andric }
12806c3fb27SDimitry Andric void __asan_report_exp_store1(uptr addr, u32 exp) {
12906c3fb27SDimitry Andric   __asan_abi_report_exp_store_n((void *)addr, exp, 1, true);
13006c3fb27SDimitry Andric }
13106c3fb27SDimitry Andric void __asan_report_exp_store2(uptr addr, u32 exp) {
13206c3fb27SDimitry Andric   __asan_abi_report_exp_store_n((void *)addr, exp, 2, true);
13306c3fb27SDimitry Andric }
13406c3fb27SDimitry Andric void __asan_report_exp_store4(uptr addr, u32 exp) {
13506c3fb27SDimitry Andric   __asan_abi_report_exp_store_n((void *)addr, exp, 4, true);
13606c3fb27SDimitry Andric }
13706c3fb27SDimitry Andric void __asan_report_exp_store8(uptr addr, u32 exp) {
13806c3fb27SDimitry Andric   __asan_abi_report_exp_store_n((void *)addr, exp, 8, true);
13906c3fb27SDimitry Andric }
14006c3fb27SDimitry Andric void __asan_report_exp_store16(uptr addr, u32 exp) {
14106c3fb27SDimitry Andric   __asan_abi_report_exp_store_n((void *)addr, exp, 16, true);
14206c3fb27SDimitry Andric }
14306c3fb27SDimitry Andric void __asan_report_exp_store_n(uptr addr, uptr size, u32 exp) {
14406c3fb27SDimitry Andric   __asan_abi_report_exp_store_n((void *)addr, size, exp, true);
14506c3fb27SDimitry Andric }
14606c3fb27SDimitry Andric 
14706c3fb27SDimitry Andric // Functions concerning memory load and store reporting (noabort variants)
14806c3fb27SDimitry Andric void __asan_report_load1_noabort(uptr addr) {
14906c3fb27SDimitry Andric   __asan_abi_report_load_n((void *)addr, 1, false);
15006c3fb27SDimitry Andric }
15106c3fb27SDimitry Andric void __asan_report_load2_noabort(uptr addr) {
15206c3fb27SDimitry Andric   __asan_abi_report_load_n((void *)addr, 2, false);
15306c3fb27SDimitry Andric }
15406c3fb27SDimitry Andric void __asan_report_load4_noabort(uptr addr) {
15506c3fb27SDimitry Andric   __asan_abi_report_load_n((void *)addr, 4, false);
15606c3fb27SDimitry Andric }
15706c3fb27SDimitry Andric void __asan_report_load8_noabort(uptr addr) {
15806c3fb27SDimitry Andric   __asan_abi_report_load_n((void *)addr, 8, false);
15906c3fb27SDimitry Andric }
16006c3fb27SDimitry Andric void __asan_report_load16_noabort(uptr addr) {
16106c3fb27SDimitry Andric   __asan_abi_report_load_n((void *)addr, 16, false);
16206c3fb27SDimitry Andric }
16306c3fb27SDimitry Andric void __asan_report_load_n_noabort(uptr addr, uptr size) {
16406c3fb27SDimitry Andric   __asan_abi_report_load_n((void *)addr, size, false);
16506c3fb27SDimitry Andric }
16606c3fb27SDimitry Andric void __asan_report_store1_noabort(uptr addr) {
16706c3fb27SDimitry Andric   __asan_abi_report_store_n((void *)addr, 1, false);
16806c3fb27SDimitry Andric }
16906c3fb27SDimitry Andric void __asan_report_store2_noabort(uptr addr) {
17006c3fb27SDimitry Andric   __asan_abi_report_store_n((void *)addr, 2, false);
17106c3fb27SDimitry Andric }
17206c3fb27SDimitry Andric void __asan_report_store4_noabort(uptr addr) {
17306c3fb27SDimitry Andric   __asan_abi_report_store_n((void *)addr, 4, false);
17406c3fb27SDimitry Andric }
17506c3fb27SDimitry Andric void __asan_report_store8_noabort(uptr addr) {
17606c3fb27SDimitry Andric   __asan_abi_report_store_n((void *)addr, 8, false);
17706c3fb27SDimitry Andric }
17806c3fb27SDimitry Andric void __asan_report_store16_noabort(uptr addr) {
17906c3fb27SDimitry Andric   __asan_abi_report_store_n((void *)addr, 16, false);
18006c3fb27SDimitry Andric }
18106c3fb27SDimitry Andric void __asan_report_store_n_noabort(uptr addr, uptr size) {
18206c3fb27SDimitry Andric   __asan_abi_report_store_n((void *)addr, size, false);
18306c3fb27SDimitry Andric }
18406c3fb27SDimitry Andric 
18506c3fb27SDimitry Andric // Functions concerning memory load and store
18606c3fb27SDimitry Andric void __asan_load1(uptr addr) { __asan_abi_load_n((void *)addr, 1, true); }
18706c3fb27SDimitry Andric void __asan_load2(uptr addr) { __asan_abi_load_n((void *)addr, 2, true); }
18806c3fb27SDimitry Andric void __asan_load4(uptr addr) { __asan_abi_load_n((void *)addr, 4, true); }
18906c3fb27SDimitry Andric void __asan_load8(uptr addr) { __asan_abi_load_n((void *)addr, 8, true); }
19006c3fb27SDimitry Andric void __asan_load16(uptr addr) { __asan_abi_load_n((void *)addr, 16, true); }
19106c3fb27SDimitry Andric void __asan_loadN(uptr addr, uptr size) {
19206c3fb27SDimitry Andric   __asan_abi_load_n((void *)addr, size, true);
19306c3fb27SDimitry Andric }
19406c3fb27SDimitry Andric void __asan_store1(uptr addr) { __asan_abi_store_n((void *)addr, 1, true); }
19506c3fb27SDimitry Andric void __asan_store2(uptr addr) { __asan_abi_store_n((void *)addr, 2, true); }
19606c3fb27SDimitry Andric void __asan_store4(uptr addr) { __asan_abi_store_n((void *)addr, 4, true); }
19706c3fb27SDimitry Andric void __asan_store8(uptr addr) { __asan_abi_store_n((void *)addr, 8, true); }
19806c3fb27SDimitry Andric void __asan_store16(uptr addr) { __asan_abi_store_n((void *)addr, 16, true); }
19906c3fb27SDimitry Andric void __asan_storeN(uptr addr, uptr size) {
20006c3fb27SDimitry Andric   __asan_abi_store_n((void *)addr, size, true);
20106c3fb27SDimitry Andric }
20206c3fb27SDimitry Andric 
20306c3fb27SDimitry Andric // Functions concerning memory load and store (experimental variants)
20406c3fb27SDimitry Andric void __asan_exp_load1(uptr addr, u32 exp) {
20506c3fb27SDimitry Andric   __asan_abi_exp_load_n((void *)addr, 1, exp, true);
20606c3fb27SDimitry Andric }
20706c3fb27SDimitry Andric void __asan_exp_load2(uptr addr, u32 exp) {
20806c3fb27SDimitry Andric   __asan_abi_exp_load_n((void *)addr, 2, exp, true);
20906c3fb27SDimitry Andric }
21006c3fb27SDimitry Andric void __asan_exp_load4(uptr addr, u32 exp) {
21106c3fb27SDimitry Andric   __asan_abi_exp_load_n((void *)addr, 4, exp, true);
21206c3fb27SDimitry Andric }
21306c3fb27SDimitry Andric void __asan_exp_load8(uptr addr, u32 exp) {
21406c3fb27SDimitry Andric   __asan_abi_exp_load_n((void *)addr, 8, exp, true);
21506c3fb27SDimitry Andric }
21606c3fb27SDimitry Andric void __asan_exp_load16(uptr addr, u32 exp) {
21706c3fb27SDimitry Andric   __asan_abi_exp_load_n((void *)addr, 16, exp, true);
21806c3fb27SDimitry Andric }
21906c3fb27SDimitry Andric void __asan_exp_loadN(uptr addr, uptr size, u32 exp) {
22006c3fb27SDimitry Andric   __asan_abi_exp_load_n((void *)addr, size, exp, true);
22106c3fb27SDimitry Andric }
22206c3fb27SDimitry Andric void __asan_exp_store1(uptr addr, u32 exp) {
22306c3fb27SDimitry Andric   __asan_abi_exp_store_n((void *)addr, 1, exp, true);
22406c3fb27SDimitry Andric }
22506c3fb27SDimitry Andric void __asan_exp_store2(uptr addr, u32 exp) {
22606c3fb27SDimitry Andric   __asan_abi_exp_store_n((void *)addr, 2, exp, true);
22706c3fb27SDimitry Andric }
22806c3fb27SDimitry Andric void __asan_exp_store4(uptr addr, u32 exp) {
22906c3fb27SDimitry Andric   __asan_abi_exp_store_n((void *)addr, 4, exp, true);
23006c3fb27SDimitry Andric }
23106c3fb27SDimitry Andric void __asan_exp_store8(uptr addr, u32 exp) {
23206c3fb27SDimitry Andric   __asan_abi_exp_store_n((void *)addr, 8, exp, true);
23306c3fb27SDimitry Andric }
23406c3fb27SDimitry Andric void __asan_exp_store16(uptr addr, u32 exp) {
23506c3fb27SDimitry Andric   __asan_abi_exp_store_n((void *)addr, 16, exp, true);
23606c3fb27SDimitry Andric }
23706c3fb27SDimitry Andric void __asan_exp_storeN(uptr addr, uptr size, u32 exp) {
23806c3fb27SDimitry Andric   __asan_abi_exp_store_n((void *)addr, size, exp, true);
23906c3fb27SDimitry Andric }
24006c3fb27SDimitry Andric 
24106c3fb27SDimitry Andric // Functions concerning memory load and store (noabort variants)
24206c3fb27SDimitry Andric void __asan_load1_noabort(uptr addr) {
24306c3fb27SDimitry Andric   __asan_abi_load_n((void *)addr, 1, false);
24406c3fb27SDimitry Andric }
24506c3fb27SDimitry Andric void __asan_load2_noabort(uptr addr) {
24606c3fb27SDimitry Andric   __asan_abi_load_n((void *)addr, 2, false);
24706c3fb27SDimitry Andric }
24806c3fb27SDimitry Andric void __asan_load4_noabort(uptr addr) {
24906c3fb27SDimitry Andric   __asan_abi_load_n((void *)addr, 4, false);
25006c3fb27SDimitry Andric }
25106c3fb27SDimitry Andric void __asan_load8_noabort(uptr addr) {
25206c3fb27SDimitry Andric   __asan_abi_load_n((void *)addr, 8, false);
25306c3fb27SDimitry Andric }
25406c3fb27SDimitry Andric void __asan_load16_noabort(uptr addr) {
25506c3fb27SDimitry Andric   __asan_abi_load_n((void *)addr, 16, false);
25606c3fb27SDimitry Andric }
25706c3fb27SDimitry Andric void __asan_loadN_noabort(uptr addr, uptr size) {
25806c3fb27SDimitry Andric   __asan_abi_load_n((void *)addr, size, false);
25906c3fb27SDimitry Andric }
26006c3fb27SDimitry Andric void __asan_store1_noabort(uptr addr) {
26106c3fb27SDimitry Andric   __asan_abi_store_n((void *)addr, 1, false);
26206c3fb27SDimitry Andric }
26306c3fb27SDimitry Andric void __asan_store2_noabort(uptr addr) {
26406c3fb27SDimitry Andric   __asan_abi_store_n((void *)addr, 2, false);
26506c3fb27SDimitry Andric }
26606c3fb27SDimitry Andric void __asan_store4_noabort(uptr addr) {
26706c3fb27SDimitry Andric   __asan_abi_store_n((void *)addr, 4, false);
26806c3fb27SDimitry Andric }
26906c3fb27SDimitry Andric void __asan_store8_noabort(uptr addr) {
27006c3fb27SDimitry Andric   __asan_abi_store_n((void *)addr, 8, false);
27106c3fb27SDimitry Andric }
27206c3fb27SDimitry Andric void __asan_store16_noabort(uptr addr) {
27306c3fb27SDimitry Andric   __asan_abi_store_n((void *)addr, 16, false);
27406c3fb27SDimitry Andric }
27506c3fb27SDimitry Andric void __asan_storeN_noabort(uptr addr, uptr size) {
27606c3fb27SDimitry Andric   __asan_abi_store_n((void *)addr, size, false);
27706c3fb27SDimitry Andric }
27806c3fb27SDimitry Andric 
27906c3fb27SDimitry Andric // Functions concerning query about whether memory is poisoned
28006c3fb27SDimitry Andric int __asan_address_is_poisoned(void const volatile *addr) {
28106c3fb27SDimitry Andric   return __asan_abi_address_is_poisoned(addr);
28206c3fb27SDimitry Andric }
28306c3fb27SDimitry Andric uptr __asan_region_is_poisoned(uptr beg, uptr size) {
28406c3fb27SDimitry Andric   return (uptr)__asan_abi_region_is_poisoned((void *)beg, size);
28506c3fb27SDimitry Andric }
28606c3fb27SDimitry Andric 
28706c3fb27SDimitry Andric // Functions concerning the poisoning of memory
28806c3fb27SDimitry Andric void __asan_poison_memory_region(void const volatile *addr, uptr size) {
28906c3fb27SDimitry Andric   __asan_abi_poison_memory_region(addr, size);
29006c3fb27SDimitry Andric }
29106c3fb27SDimitry Andric void __asan_unpoison_memory_region(void const volatile *addr, uptr size) {
29206c3fb27SDimitry Andric   __asan_abi_unpoison_memory_region(addr, size);
29306c3fb27SDimitry Andric }
29406c3fb27SDimitry Andric 
29506c3fb27SDimitry Andric // Functions concerning the partial poisoning of memory
29606c3fb27SDimitry Andric void __asan_set_shadow_00(uptr addr, uptr size) {
29706c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0x00, size);
29806c3fb27SDimitry Andric }
29906c3fb27SDimitry Andric void __asan_set_shadow_01(uptr addr, uptr size) {
30006c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0x01, size);
30106c3fb27SDimitry Andric }
30206c3fb27SDimitry Andric void __asan_set_shadow_02(uptr addr, uptr size) {
30306c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0x02, size);
30406c3fb27SDimitry Andric }
30506c3fb27SDimitry Andric void __asan_set_shadow_03(uptr addr, uptr size) {
30606c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0x03, size);
30706c3fb27SDimitry Andric }
30806c3fb27SDimitry Andric void __asan_set_shadow_04(uptr addr, uptr size) {
30906c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0x04, size);
31006c3fb27SDimitry Andric }
31106c3fb27SDimitry Andric void __asan_set_shadow_05(uptr addr, uptr size) {
31206c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0x05, size);
31306c3fb27SDimitry Andric }
31406c3fb27SDimitry Andric void __asan_set_shadow_06(uptr addr, uptr size) {
31506c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0x06, size);
31606c3fb27SDimitry Andric }
31706c3fb27SDimitry Andric void __asan_set_shadow_07(uptr addr, uptr size) {
31806c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0x07, size);
31906c3fb27SDimitry Andric }
32006c3fb27SDimitry Andric void __asan_set_shadow_f1(uptr addr, uptr size) {
32106c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0xf1, size);
32206c3fb27SDimitry Andric }
32306c3fb27SDimitry Andric void __asan_set_shadow_f2(uptr addr, uptr size) {
32406c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0xf2, size);
32506c3fb27SDimitry Andric }
32606c3fb27SDimitry Andric void __asan_set_shadow_f3(uptr addr, uptr size) {
32706c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0xf3, size);
32806c3fb27SDimitry Andric }
32906c3fb27SDimitry Andric void __asan_set_shadow_f5(uptr addr, uptr size) {
33006c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0xf5, size);
33106c3fb27SDimitry Andric }
33206c3fb27SDimitry Andric void __asan_set_shadow_f8(uptr addr, uptr size) {
33306c3fb27SDimitry Andric   __asan_abi_set_shadow_xx_n((void *)addr, 0xf8, size);
33406c3fb27SDimitry Andric }
33506c3fb27SDimitry Andric 
33606c3fb27SDimitry Andric // Functions concerning stack poisoning
33706c3fb27SDimitry Andric void __asan_poison_stack_memory(uptr addr, uptr size) {
33806c3fb27SDimitry Andric   __asan_abi_poison_stack_memory((void *)addr, size);
33906c3fb27SDimitry Andric }
34006c3fb27SDimitry Andric void __asan_unpoison_stack_memory(uptr addr, uptr size) {
34106c3fb27SDimitry Andric   __asan_abi_unpoison_stack_memory((void *)addr, size);
34206c3fb27SDimitry Andric }
34306c3fb27SDimitry Andric 
34406c3fb27SDimitry Andric // Functions concerning redzone poisoning
3455f757f3fSDimitry Andric void __asan_poison_intra_object_redzone(uptr p, uptr size) {
3465f757f3fSDimitry Andric   __asan_abi_poison_intra_object_redzone((void *)p, size);
3475f757f3fSDimitry Andric }
3485f757f3fSDimitry Andric void __asan_unpoison_intra_object_redzone(uptr p, uptr size) {
3495f757f3fSDimitry Andric   __asan_abi_unpoison_intra_object_redzone((void *)p, size);
3505f757f3fSDimitry Andric }
35106c3fb27SDimitry Andric 
35206c3fb27SDimitry Andric // Functions concerning array cookie poisoning
3535f757f3fSDimitry Andric void __asan_poison_cxx_array_cookie(uptr p) {
3545f757f3fSDimitry Andric   __asan_abi_poison_cxx_array_cookie((void *)p);
3555f757f3fSDimitry Andric }
35606c3fb27SDimitry Andric uptr __asan_load_cxx_array_cookie(uptr *p) {
3575f757f3fSDimitry Andric   return (uptr)__asan_abi_load_cxx_array_cookie((void **)p);
35806c3fb27SDimitry Andric }
35906c3fb27SDimitry Andric 
36006c3fb27SDimitry Andric // Functions concerning fake stacks
36106c3fb27SDimitry Andric void *__asan_get_current_fake_stack(void) {
3625f757f3fSDimitry Andric   return __asan_abi_get_current_fake_stack();
36306c3fb27SDimitry Andric }
36406c3fb27SDimitry Andric void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg,
36506c3fb27SDimitry Andric                                    void **end) {
3665f757f3fSDimitry Andric   return __asan_abi_addr_is_in_fake_stack(fake_stack, addr, beg, end);
36706c3fb27SDimitry Andric }
36806c3fb27SDimitry Andric 
36906c3fb27SDimitry Andric // Functions concerning poisoning and unpoisoning fake stack alloca
37006c3fb27SDimitry Andric void __asan_alloca_poison(uptr addr, uptr size) {
37106c3fb27SDimitry Andric   __asan_abi_alloca_poison((void *)addr, size);
37206c3fb27SDimitry Andric }
37306c3fb27SDimitry Andric void __asan_allocas_unpoison(uptr top, uptr bottom) {
37406c3fb27SDimitry Andric   __asan_abi_allocas_unpoison((void *)top, (void *)bottom);
37506c3fb27SDimitry Andric }
37606c3fb27SDimitry Andric 
37706c3fb27SDimitry Andric // Functions concerning fake stack malloc
37806c3fb27SDimitry Andric uptr __asan_stack_malloc_0(uptr size) {
37906c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_n(0, size);
38006c3fb27SDimitry Andric }
38106c3fb27SDimitry Andric uptr __asan_stack_malloc_1(uptr size) {
38206c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_n(1, size);
38306c3fb27SDimitry Andric }
38406c3fb27SDimitry Andric uptr __asan_stack_malloc_2(uptr size) {
38506c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_n(2, size);
38606c3fb27SDimitry Andric }
38706c3fb27SDimitry Andric uptr __asan_stack_malloc_3(uptr size) {
38806c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_n(3, size);
38906c3fb27SDimitry Andric }
39006c3fb27SDimitry Andric uptr __asan_stack_malloc_4(uptr size) {
39106c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_n(4, size);
39206c3fb27SDimitry Andric }
39306c3fb27SDimitry Andric uptr __asan_stack_malloc_5(uptr size) {
39406c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_n(5, size);
39506c3fb27SDimitry Andric }
39606c3fb27SDimitry Andric uptr __asan_stack_malloc_6(uptr size) {
39706c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_n(6, size);
39806c3fb27SDimitry Andric }
39906c3fb27SDimitry Andric uptr __asan_stack_malloc_7(uptr size) {
40006c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_n(7, size);
40106c3fb27SDimitry Andric }
40206c3fb27SDimitry Andric uptr __asan_stack_malloc_8(uptr size) {
40306c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_n(8, size);
40406c3fb27SDimitry Andric }
40506c3fb27SDimitry Andric uptr __asan_stack_malloc_9(uptr size) {
40606c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_n(9, size);
40706c3fb27SDimitry Andric }
40806c3fb27SDimitry Andric uptr __asan_stack_malloc_10(uptr size) {
40906c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_n(10, size);
41006c3fb27SDimitry Andric }
41106c3fb27SDimitry Andric 
41206c3fb27SDimitry Andric // Functions concerning fake stack malloc (always variants)
41306c3fb27SDimitry Andric uptr __asan_stack_malloc_always_0(uptr size) {
41406c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_always_n(0, size);
41506c3fb27SDimitry Andric }
41606c3fb27SDimitry Andric uptr __asan_stack_malloc_always_1(uptr size) {
41706c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_always_n(1, size);
41806c3fb27SDimitry Andric }
41906c3fb27SDimitry Andric uptr __asan_stack_malloc_always_2(uptr size) {
42006c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_always_n(2, size);
42106c3fb27SDimitry Andric }
42206c3fb27SDimitry Andric uptr __asan_stack_malloc_always_3(uptr size) {
42306c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_always_n(3, size);
42406c3fb27SDimitry Andric }
42506c3fb27SDimitry Andric uptr __asan_stack_malloc_always_4(uptr size) {
42606c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_always_n(4, size);
42706c3fb27SDimitry Andric }
42806c3fb27SDimitry Andric uptr __asan_stack_malloc_always_5(uptr size) {
42906c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_always_n(5, size);
43006c3fb27SDimitry Andric }
43106c3fb27SDimitry Andric uptr __asan_stack_malloc_always_6(uptr size) {
43206c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_always_n(6, size);
43306c3fb27SDimitry Andric }
43406c3fb27SDimitry Andric uptr __asan_stack_malloc_always_7(uptr size) {
43506c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_always_n(7, size);
43606c3fb27SDimitry Andric }
43706c3fb27SDimitry Andric uptr __asan_stack_malloc_always_8(uptr size) {
43806c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_always_n(8, size);
43906c3fb27SDimitry Andric }
44006c3fb27SDimitry Andric uptr __asan_stack_malloc_always_9(uptr size) {
44106c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_always_n(9, size);
44206c3fb27SDimitry Andric }
44306c3fb27SDimitry Andric uptr __asan_stack_malloc_always_10(uptr size) {
44406c3fb27SDimitry Andric   return (uptr)__asan_abi_stack_malloc_always_n(10, size);
44506c3fb27SDimitry Andric }
44606c3fb27SDimitry Andric 
44706c3fb27SDimitry Andric // Functions concerning fake stack free
44806c3fb27SDimitry Andric void __asan_stack_free_0(uptr ptr, uptr size) {
44906c3fb27SDimitry Andric   __asan_abi_stack_free_n(0, (void *)ptr, size);
45006c3fb27SDimitry Andric }
45106c3fb27SDimitry Andric void __asan_stack_free_1(uptr ptr, uptr size) {
45206c3fb27SDimitry Andric   __asan_abi_stack_free_n(1, (void *)ptr, size);
45306c3fb27SDimitry Andric }
45406c3fb27SDimitry Andric void __asan_stack_free_2(uptr ptr, uptr size) {
45506c3fb27SDimitry Andric   __asan_abi_stack_free_n(2, (void *)ptr, size);
45606c3fb27SDimitry Andric }
45706c3fb27SDimitry Andric void __asan_stack_free_3(uptr ptr, uptr size) {
45806c3fb27SDimitry Andric   __asan_abi_stack_free_n(3, (void *)ptr, size);
45906c3fb27SDimitry Andric }
46006c3fb27SDimitry Andric void __asan_stack_free_4(uptr ptr, uptr size) {
46106c3fb27SDimitry Andric   __asan_abi_stack_free_n(4, (void *)ptr, size);
46206c3fb27SDimitry Andric }
46306c3fb27SDimitry Andric void __asan_stack_free_5(uptr ptr, uptr size) {
46406c3fb27SDimitry Andric   __asan_abi_stack_free_n(5, (void *)ptr, size);
46506c3fb27SDimitry Andric }
46606c3fb27SDimitry Andric void __asan_stack_free_6(uptr ptr, uptr size) {
46706c3fb27SDimitry Andric   __asan_abi_stack_free_n(6, (void *)ptr, size);
46806c3fb27SDimitry Andric }
46906c3fb27SDimitry Andric void __asan_stack_free_7(uptr ptr, uptr size) {
47006c3fb27SDimitry Andric   __asan_abi_stack_free_n(7, (void *)ptr, size);
47106c3fb27SDimitry Andric }
47206c3fb27SDimitry Andric void __asan_stack_free_8(uptr ptr, uptr size) {
47306c3fb27SDimitry Andric   __asan_abi_stack_free_n(8, (void *)ptr, size);
47406c3fb27SDimitry Andric }
47506c3fb27SDimitry Andric void __asan_stack_free_9(uptr ptr, uptr size) {
47606c3fb27SDimitry Andric   __asan_abi_stack_free_n(9, (void *)ptr, size);
47706c3fb27SDimitry Andric }
47806c3fb27SDimitry Andric void __asan_stack_free_10(uptr ptr, uptr size) {
47906c3fb27SDimitry Andric   __asan_abi_stack_free_n(10, (void *)ptr, size);
48006c3fb27SDimitry Andric }
48106c3fb27SDimitry Andric }
482