mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-18 20:48:07 +00:00
split up __afl_manual_init, added internal AFL_DISABLE_LLVM_INSTRUMENTATION, skipping ctor+ifunc functions for all llvm, code-format
This commit is contained in:
@ -35,6 +35,8 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/mman.h>
|
||||
@ -842,9 +844,22 @@ void __afl_manual_init(void) {
|
||||
|
||||
static u8 init_done;
|
||||
|
||||
if (getenv("AFL_DISABLE_LLVM_INSTRUMENTATION")) {
|
||||
|
||||
init_done = 1;
|
||||
is_persistent = 0;
|
||||
__afl_sharedmem_fuzzing = 0;
|
||||
if (__afl_area_ptr == NULL) __afl_area_ptr = __afl_area_initial;
|
||||
|
||||
if (getenv("AFL_DEBUG"))
|
||||
fprintf(stderr,
|
||||
"DEBUG: disabled instrumenation because of "
|
||||
"AFL_DISABLE_LLVM_INSTRUMENTATION\n");
|
||||
|
||||
}
|
||||
|
||||
if (!init_done) {
|
||||
|
||||
__afl_map_shm();
|
||||
__afl_start_forkserver();
|
||||
init_done = 1;
|
||||
|
||||
@ -852,11 +867,11 @@ void __afl_manual_init(void) {
|
||||
|
||||
}
|
||||
|
||||
/* Proper initialization routine. */
|
||||
/* Initialization of the forkserver - latest possible */
|
||||
|
||||
__attribute__((constructor(CONST_PRIO))) void __afl_auto_init(void) {
|
||||
__attribute__((constructor())) void __afl_auto_init(void) {
|
||||
|
||||
is_persistent = !!getenv(PERSIST_ENV_VAR);
|
||||
if (getenv("AFL_DISABLE_LLVM_INSTRUMENTATION")) return;
|
||||
|
||||
if (getenv(DEFER_ENV_VAR)) return;
|
||||
|
||||
@ -864,6 +879,18 @@ __attribute__((constructor(CONST_PRIO))) void __afl_auto_init(void) {
|
||||
|
||||
}
|
||||
|
||||
/* Initialization of the shmem - earliest possible because of LTO fixed mem. */
|
||||
|
||||
__attribute__((constructor(0))) void __afl_auto_early(void) {
|
||||
|
||||
if (getenv("AFL_DISABLE_LLVM_INSTRUMENTATION")) return;
|
||||
|
||||
is_persistent = !!getenv(PERSIST_ENV_VAR);
|
||||
|
||||
__afl_map_shm();
|
||||
|
||||
}
|
||||
|
||||
/* The following stuff deals with supporting -fsanitize-coverage=trace-pc-guard.
|
||||
It remains non-operational in the traditional, plugin-backed LLVM mode.
|
||||
For more info about 'trace-pc-guard', see llvm_mode/README.md.
|
||||
@ -912,7 +939,8 @@ void __sanitizer_cov_trace_pc_guard(uint32_t *guard) {
|
||||
|
||||
#else
|
||||
|
||||
__afl_area_ptr[*guard] = __afl_area_ptr[*guard] + 1 + (__afl_area_ptr[*guard] == 255 ? 1 : 0);
|
||||
__afl_area_ptr[*guard] =
|
||||
__afl_area_ptr[*guard] + 1 + (__afl_area_ptr[*guard] == 255 ? 1 : 0);
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user