1//===-asan_abi.h - ASan Stable ABI Interface-------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef ASAN_ABI_H
10#define ASAN_ABI_H
11
12#include <stdbool.h>
13#include <stddef.h>
14#include <sys/cdefs.h>
15#include <sys/types.h>
16
17__BEGIN_DECLS
18
19// Functions concerning instrumented global variables:
20void __asan_abi_register_image_globals();
21void __asan_abi_unregister_image_globals();
22void __asan_abi_register_elf_globals(bool *flag, void *start, void *stop);
23void __asan_abi_unregister_elf_globals(bool *flag, void *start, void *stop);
24void __asan_abi_register_globals(void *globals, size_t n);
25void __asan_abi_unregister_globals(void *globals, size_t n);
26
27// Functions concerning dynamic library initialization
28void __asan_abi_before_dynamic_init(const char *module_name);
29void __asan_abi_after_dynamic_init();
30
31// Functions concerning block memory destinations
32void *__asan_abi_memcpy(void *d, const void *s, size_t n);
33void *__asan_abi_memmove(void *d, const void *s, size_t n);
34void *__asan_abi_memset(void *p, int c, size_t n);
35
36// Functions concerning RTL startup and initialization
37void __asan_abi_init();
38void __asan_abi_handle_no_return();
39
40// Functions concerning memory load and store reporting
41void __asan_abi_report_load_n(void *p, size_t n, bool abort);
42void __asan_abi_report_exp_load_n(void *p, size_t n, int exp, bool abort);
43void __asan_abi_report_store_n(void *p, size_t n, bool abort);
44void __asan_abi_report_exp_store_n(void *p, size_t n, int exp, bool abort);
45
46// Functions concerning memory load and store
47void __asan_abi_load_n(void *p, size_t n, bool abort);
48void __asan_abi_exp_load_n(void *p, size_t n, int exp, bool abort);
49void __asan_abi_store_n(void *p, size_t n, bool abort);
50void __asan_abi_exp_store_n(void *p, size_t n, int exp, bool abort);
51
52// Functions concerning query about whether memory is poisoned
53int __asan_abi_address_is_poisoned(void const volatile *p);
54void *__asan_abi_region_is_poisoned(void const volatile *p, size_t size);
55
56// Functions concerning the poisoning of memory
57void __asan_abi_unpoison_memory_region(void const volatile *p, size_t n);
58void __asan_abi_poison_memory_region(void const volatile *p, size_t n);
59
60// Functions concerning the partial poisoning of memory
61void __asan_abi_set_shadow_xx_n(void *p, unsigned char xx, size_t n);
62
63// Functions concerning stack poisoning
64void __asan_abi_poison_stack_memory(void *p, size_t n);
65void __asan_abi_unpoison_stack_memory(void *p, size_t n);
66
67// Functions concerning redzone poisoning
68void __asan_abi_poison_intra_object_redzone(void *p, size_t size);
69void __asan_abi_unpoison_intra_object_redzone(void *p, size_t size);
70
71// Functions concerning array cookie poisoning
72void __asan_abi_poison_cxx_array_cookie(void *p);
73void *__asan_abi_load_cxx_array_cookie(void **p);
74
75// Functions concerning fake stacks
76void *__asan_abi_get_current_fake_stack();
77void *__asan_abi_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg,
78 void **end);
79// Functions concerning poisoning and unpoisoning fake stack alloca
80void __asan_abi_alloca_poison(void *addr, size_t size);
81void __asan_abi_allocas_unpoison(void *top, void *bottom);
82
83// Functions concerning fake stack malloc
84void *__asan_abi_stack_malloc_n(size_t scale, size_t size);
85void *__asan_abi_stack_malloc_always_n(size_t scale, size_t size);
86
87// Functions concerning fake stack free
88void __asan_abi_stack_free_n(int scale, void *p, size_t n);
89
90__END_DECLS
91#endif // ASAN_ABI_H
92

source code of compiler-rt/lib/asan_abi/asan_abi.h