2017-08-22 07:25:50 +08:00
|
|
|
//===- FuzzerExtFunctions.def - External functions --------------*- C++ -* ===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2017-08-22 07:25:50 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// This defines the external function pointers that
|
|
|
|
// ``fuzzer::ExternalFunctions`` should contain and try to initialize. The
|
|
|
|
// EXT_FUNC macro must be defined at the point of inclusion. The signature of
|
|
|
|
// the macro is:
|
|
|
|
//
|
|
|
|
// EXT_FUNC(<name>, <return_type>, <function_signature>, <warn_if_missing>)
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// Optional user functions
|
|
|
|
EXT_FUNC(LLVMFuzzerInitialize, int, (int *argc, char ***argv), false);
|
|
|
|
EXT_FUNC(LLVMFuzzerCustomMutator, size_t,
|
[compiler-rt] Move FDP to include/fuzzer/FuzzedDataProvider.h for easier use.
Summary:
FuzzedDataProvider is a helper class for writing fuzz targets that fuzz
multple inputs simultaneously. The header is supposed to be used for fuzzing
engine agnostic fuzz targets (i.e. the same target can be used with libFuzzer,
AFL, honggfuzz, and other engines). The common thing though is that fuzz targets
are typically compiled with clang, as it provides all sanitizers as well as
different coverage instrumentation modes. Therefore, making this FDP class a
part of the compiler-rt installation package would make it easier to develop
and distribute fuzz targets across different projects, build systems, etc.
Some context also available in https://github.com/google/oss-fuzz/pull/2547.
This CL does not delete the header from `lib/fuzzer/utils` directory in order to
provide the downstream users some time for a smooth migration to the new
header location.
Reviewers: kcc, morehouse
Reviewed By: morehouse
Subscribers: lebedev.ri, kubamracek, dberris, mgorny, delcypher, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D65661
llvm-svn: 367917
2019-08-06 03:55:52 +08:00
|
|
|
(uint8_t *Data, size_t Size, size_t MaxSize, unsigned int Seed),
|
2017-08-22 07:25:50 +08:00
|
|
|
false);
|
|
|
|
EXT_FUNC(LLVMFuzzerCustomCrossOver, size_t,
|
[compiler-rt] Move FDP to include/fuzzer/FuzzedDataProvider.h for easier use.
Summary:
FuzzedDataProvider is a helper class for writing fuzz targets that fuzz
multple inputs simultaneously. The header is supposed to be used for fuzzing
engine agnostic fuzz targets (i.e. the same target can be used with libFuzzer,
AFL, honggfuzz, and other engines). The common thing though is that fuzz targets
are typically compiled with clang, as it provides all sanitizers as well as
different coverage instrumentation modes. Therefore, making this FDP class a
part of the compiler-rt installation package would make it easier to develop
and distribute fuzz targets across different projects, build systems, etc.
Some context also available in https://github.com/google/oss-fuzz/pull/2547.
This CL does not delete the header from `lib/fuzzer/utils` directory in order to
provide the downstream users some time for a smooth migration to the new
header location.
Reviewers: kcc, morehouse
Reviewed By: morehouse
Subscribers: lebedev.ri, kubamracek, dberris, mgorny, delcypher, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D65661
llvm-svn: 367917
2019-08-06 03:55:52 +08:00
|
|
|
(const uint8_t *Data1, size_t Size1,
|
|
|
|
const uint8_t *Data2, size_t Size2,
|
|
|
|
uint8_t *Out, size_t MaxOutSize, unsigned int Seed),
|
2017-08-22 07:25:50 +08:00
|
|
|
false);
|
|
|
|
|
|
|
|
// Sanitizer functions
|
|
|
|
EXT_FUNC(__lsan_enable, void, (), false);
|
|
|
|
EXT_FUNC(__lsan_disable, void, (), false);
|
|
|
|
EXT_FUNC(__lsan_do_recoverable_leak_check, int, (), false);
|
2019-02-09 09:45:29 +08:00
|
|
|
EXT_FUNC(__sanitizer_acquire_crash_state, int, (), true);
|
2017-08-22 07:25:50 +08:00
|
|
|
EXT_FUNC(__sanitizer_install_malloc_and_free_hooks, int,
|
|
|
|
(void (*malloc_hook)(const volatile void *, size_t),
|
|
|
|
void (*free_hook)(const volatile void *)),
|
|
|
|
false);
|
2019-09-17 08:34:41 +08:00
|
|
|
EXT_FUNC(__sanitizer_log_write, void, (const char *buf, size_t len), false);
|
2017-10-24 06:04:30 +08:00
|
|
|
EXT_FUNC(__sanitizer_purge_allocator, void, (), false);
|
2019-07-24 02:26:53 +08:00
|
|
|
EXT_FUNC(__sanitizer_print_memory_profile, void, (size_t, size_t), false);
|
2017-08-22 07:25:50 +08:00
|
|
|
EXT_FUNC(__sanitizer_print_stack_trace, void, (), true);
|
|
|
|
EXT_FUNC(__sanitizer_symbolize_pc, void,
|
|
|
|
(void *, const char *fmt, char *out_buf, size_t out_buf_size), false);
|
|
|
|
EXT_FUNC(__sanitizer_get_module_and_offset_for_pc, int,
|
|
|
|
(void *pc, char *module_path,
|
|
|
|
size_t module_path_len,void **pc_offset), false);
|
|
|
|
EXT_FUNC(__sanitizer_set_death_callback, void, (void (*)(void)), true);
|
|
|
|
EXT_FUNC(__sanitizer_set_report_fd, void, (void*), false);
|
2018-07-10 07:51:08 +08:00
|
|
|
EXT_FUNC(__msan_scoped_disable_interceptor_checks, void, (), false);
|
|
|
|
EXT_FUNC(__msan_scoped_enable_interceptor_checks, void, (), false);
|
|
|
|
EXT_FUNC(__msan_unpoison, void, (const volatile void *, size_t size), false);
|
2019-05-10 06:48:46 +08:00
|
|
|
EXT_FUNC(__msan_unpoison_param, void, (size_t n), false);
|