george.karpenkov | 29efa6d | 2017-08-21 23:25:50 +0000 | [diff] [blame] | 1 | //===- FuzzerExtFunctions.def - External functions --------------*- C++ -* ===// |
| 2 | // |
chandlerc | 4028449 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
george.karpenkov | 29efa6d | 2017-08-21 23:25:50 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // This defines the external function pointers that |
| 9 | // ``fuzzer::ExternalFunctions`` should contain and try to initialize. The |
| 10 | // EXT_FUNC macro must be defined at the point of inclusion. The signature of |
| 11 | // the macro is: |
| 12 | // |
| 13 | // EXT_FUNC(<name>, <return_type>, <function_signature>, <warn_if_missing>) |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | // Optional user functions |
| 17 | EXT_FUNC(LLVMFuzzerInitialize, int, (int *argc, char ***argv), false); |
| 18 | EXT_FUNC(LLVMFuzzerCustomMutator, size_t, |
dor1s | 78e9a67 | 2019-08-05 19:55:52 +0000 | [diff] [blame] | 19 | (uint8_t *Data, size_t Size, size_t MaxSize, unsigned int Seed), |
george.karpenkov | 29efa6d | 2017-08-21 23:25:50 +0000 | [diff] [blame] | 20 | false); |
| 21 | EXT_FUNC(LLVMFuzzerCustomCrossOver, size_t, |
dor1s | 78e9a67 | 2019-08-05 19:55:52 +0000 | [diff] [blame] | 22 | (const uint8_t *Data1, size_t Size1, |
| 23 | const uint8_t *Data2, size_t Size2, |
| 24 | uint8_t *Out, size_t MaxOutSize, unsigned int Seed), |
george.karpenkov | 29efa6d | 2017-08-21 23:25:50 +0000 | [diff] [blame] | 25 | false); |
| 26 | |
| 27 | // Sanitizer functions |
| 28 | EXT_FUNC(__lsan_enable, void, (), false); |
| 29 | EXT_FUNC(__lsan_disable, void, (), false); |
| 30 | EXT_FUNC(__lsan_do_recoverable_leak_check, int, (), false); |
dlj | 9e8035d | 2019-02-09 01:45:29 +0000 | [diff] [blame] | 31 | EXT_FUNC(__sanitizer_acquire_crash_state, int, (), true); |
george.karpenkov | 29efa6d | 2017-08-21 23:25:50 +0000 | [diff] [blame] | 32 | EXT_FUNC(__sanitizer_install_malloc_and_free_hooks, int, |
| 33 | (void (*malloc_hook)(const volatile void *, size_t), |
| 34 | void (*free_hook)(const volatile void *)), |
| 35 | false); |
jakehehrlich | 1c53389 | 2019-09-17 00:34:41 +0000 | [diff] [blame] | 36 | EXT_FUNC(__sanitizer_log_write, void, (const char *buf, size_t len), false); |
alekseyshl | d995b55 | 2017-10-23 22:04:30 +0000 | [diff] [blame] | 37 | EXT_FUNC(__sanitizer_purge_allocator, void, (), false); |
dor1s | 9ee0f58 | 2019-07-23 18:26:53 +0000 | [diff] [blame] | 38 | EXT_FUNC(__sanitizer_print_memory_profile, void, (size_t, size_t), false); |
george.karpenkov | 29efa6d | 2017-08-21 23:25:50 +0000 | [diff] [blame] | 39 | EXT_FUNC(__sanitizer_print_stack_trace, void, (), true); |
| 40 | EXT_FUNC(__sanitizer_symbolize_pc, void, |
| 41 | (void *, const char *fmt, char *out_buf, size_t out_buf_size), false); |
| 42 | EXT_FUNC(__sanitizer_get_module_and_offset_for_pc, int, |
| 43 | (void *pc, char *module_path, |
| 44 | size_t module_path_len,void **pc_offset), false); |
| 45 | EXT_FUNC(__sanitizer_set_death_callback, void, (void (*)(void)), true); |
| 46 | EXT_FUNC(__sanitizer_set_report_fd, void, (void*), false); |
morehouse | 1467b79 | 2018-07-09 23:51:08 +0000 | [diff] [blame] | 47 | EXT_FUNC(__msan_scoped_disable_interceptor_checks, void, (), false); |
| 48 | EXT_FUNC(__msan_scoped_enable_interceptor_checks, void, (), false); |
| 49 | EXT_FUNC(__msan_unpoison, void, (const volatile void *, size_t size), false); |
morehouse | da81f34 | 2019-05-09 22:48:46 +0000 | [diff] [blame] | 50 | EXT_FUNC(__msan_unpoison_param, void, (size_t n), false); |