xref: /freebsd/contrib/llvm-project/compiler-rt/lib/asan_abi/asan_abi.cpp (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
106c3fb27SDimitry Andric //===-asan_abi.cpp - ASan Stable ABI---------------------------------------===//
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_abi.h"
1006c3fb27SDimitry Andric 
1106c3fb27SDimitry Andric extern "C" {
1206c3fb27SDimitry Andric // Functions concerning instrumented global variables:
1306c3fb27SDimitry Andric void __asan_abi_register_image_globals(void) {}
1406c3fb27SDimitry Andric void __asan_abi_unregister_image_globals(void) {}
15*5f757f3fSDimitry Andric void __asan_abi_register_elf_globals(bool *flag, void *start, void *stop) {}
16*5f757f3fSDimitry Andric void __asan_abi_unregister_elf_globals(bool *flag, void *start, void *stop) {}
17*5f757f3fSDimitry Andric void __asan_abi_register_globals(void *globals, size_t n) {}
18*5f757f3fSDimitry Andric void __asan_abi_unregister_globals(void *globals, size_t n) {}
1906c3fb27SDimitry Andric 
2006c3fb27SDimitry Andric // Functions concerning dynamic library initialization
2106c3fb27SDimitry Andric void __asan_abi_before_dynamic_init(const char *module_name) {}
2206c3fb27SDimitry Andric void __asan_abi_after_dynamic_init(void) {}
2306c3fb27SDimitry Andric 
2406c3fb27SDimitry Andric // Functions concerning block memory destinations
2506c3fb27SDimitry Andric void *__asan_abi_memcpy(void *d, const void *s, size_t n) { return NULL; }
2606c3fb27SDimitry Andric void *__asan_abi_memmove(void *d, const void *s, size_t n) { return NULL; }
2706c3fb27SDimitry Andric void *__asan_abi_memset(void *p, int c, size_t n) { return NULL; }
2806c3fb27SDimitry Andric 
2906c3fb27SDimitry Andric // Functions concerning RTL startup and initialization
3006c3fb27SDimitry Andric void __asan_abi_init(void) {}
3106c3fb27SDimitry Andric void __asan_abi_handle_no_return(void) {}
3206c3fb27SDimitry Andric 
3306c3fb27SDimitry Andric // Functions concerning memory load and store reporting
3406c3fb27SDimitry Andric void __asan_abi_report_load_n(void *p, size_t n, bool abort) {}
3506c3fb27SDimitry Andric void __asan_abi_report_exp_load_n(void *p, size_t n, int exp, bool abort) {}
3606c3fb27SDimitry Andric void __asan_abi_report_store_n(void *p, size_t n, bool abort) {}
3706c3fb27SDimitry Andric void __asan_abi_report_exp_store_n(void *p, size_t n, int exp, bool abort) {}
3806c3fb27SDimitry Andric 
3906c3fb27SDimitry Andric // Functions concerning memory load and store
4006c3fb27SDimitry Andric void __asan_abi_load_n(void *p, size_t n, bool abort) {}
4106c3fb27SDimitry Andric void __asan_abi_exp_load_n(void *p, size_t n, int exp, bool abort) {}
4206c3fb27SDimitry Andric void __asan_abi_store_n(void *p, size_t n, bool abort) {}
4306c3fb27SDimitry Andric void __asan_abi_exp_store_n(void *p, size_t n, int exp, bool abort) {}
4406c3fb27SDimitry Andric 
4506c3fb27SDimitry Andric // Functions concerning query about whether memory is poisoned
4606c3fb27SDimitry Andric int __asan_abi_address_is_poisoned(void const volatile *p) { return 0; }
4706c3fb27SDimitry Andric void *__asan_abi_region_is_poisoned(void const volatile *p, size_t size) {
4806c3fb27SDimitry Andric   return NULL;
4906c3fb27SDimitry Andric }
5006c3fb27SDimitry Andric 
5106c3fb27SDimitry Andric // Functions concerning the poisoning of memory
5206c3fb27SDimitry Andric void __asan_abi_poison_memory_region(void const volatile *p, size_t n) {}
5306c3fb27SDimitry Andric void __asan_abi_unpoison_memory_region(void const volatile *p, size_t n) {}
5406c3fb27SDimitry Andric 
5506c3fb27SDimitry Andric // Functions concerning the partial poisoning of memory
5606c3fb27SDimitry Andric void __asan_abi_set_shadow_xx_n(void *p, unsigned char xx, size_t n) {}
5706c3fb27SDimitry Andric 
5806c3fb27SDimitry Andric // Functions concerning stack poisoning
5906c3fb27SDimitry Andric void __asan_abi_poison_stack_memory(void *p, size_t n) {}
6006c3fb27SDimitry Andric void __asan_abi_unpoison_stack_memory(void *p, size_t n) {}
6106c3fb27SDimitry Andric 
6206c3fb27SDimitry Andric // Functions concerning redzone poisoning
6306c3fb27SDimitry Andric void __asan_abi_poison_intra_object_redzone(void *p, size_t size) {}
6406c3fb27SDimitry Andric void __asan_abi_unpoison_intra_object_redzone(void *p, size_t size) {}
6506c3fb27SDimitry Andric 
6606c3fb27SDimitry Andric // Functions concerning array cookie poisoning
6706c3fb27SDimitry Andric void __asan_abi_poison_cxx_array_cookie(void *p) {}
6806c3fb27SDimitry Andric void *__asan_abi_load_cxx_array_cookie(void **p) { return NULL; }
6906c3fb27SDimitry Andric 
7006c3fb27SDimitry Andric // Functions concerning fake stacks
7106c3fb27SDimitry Andric void *__asan_abi_get_current_fake_stack(void) { return NULL; }
7206c3fb27SDimitry Andric void *__asan_abi_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg,
7306c3fb27SDimitry Andric                                        void **end) {
7406c3fb27SDimitry Andric   return NULL;
7506c3fb27SDimitry Andric }
7606c3fb27SDimitry Andric 
7706c3fb27SDimitry Andric // Functions concerning poisoning and unpoisoning fake stack alloca
7806c3fb27SDimitry Andric void __asan_abi_alloca_poison(void *addr, size_t size) {}
7906c3fb27SDimitry Andric void __asan_abi_allocas_unpoison(void *top, void *bottom) {}
8006c3fb27SDimitry Andric 
8106c3fb27SDimitry Andric // Functions concerning fake stack malloc
8206c3fb27SDimitry Andric void *__asan_abi_stack_malloc_n(size_t scale, size_t size) { return NULL; }
8306c3fb27SDimitry Andric void *__asan_abi_stack_malloc_always_n(size_t scale, size_t size) {
8406c3fb27SDimitry Andric   return NULL;
8506c3fb27SDimitry Andric }
8606c3fb27SDimitry Andric 
8706c3fb27SDimitry Andric // Functions concerning fake stack free
8806c3fb27SDimitry Andric void __asan_abi_stack_free_n(int scale, void *p, size_t n) {}
8906c3fb27SDimitry Andric }
90