mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 11:08:06 +00:00
forkserver debug flag support
This commit is contained in:
@ -83,6 +83,8 @@ typedef struct afl_forkserver {
|
|||||||
|
|
||||||
bool uses_asan; /* Target uses ASAN? */
|
bool uses_asan; /* Target uses ASAN? */
|
||||||
|
|
||||||
|
bool debug; /* debug mode? */
|
||||||
|
|
||||||
bool uses_crash_exitcode; /* Custom crash exitcode specified? */
|
bool uses_crash_exitcode; /* Custom crash exitcode specified? */
|
||||||
u8 crash_exitcode; /* The crash exitcode specified */
|
u8 crash_exitcode; /* The crash exitcode specified */
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ void afl_fsrv_init(afl_forkserver_t *fsrv) {
|
|||||||
fsrv->map_size = get_map_size();
|
fsrv->map_size = get_map_size();
|
||||||
fsrv->use_fauxsrv = false;
|
fsrv->use_fauxsrv = false;
|
||||||
fsrv->last_run_timed_out = false;
|
fsrv->last_run_timed_out = false;
|
||||||
|
fsrv->debug = false;
|
||||||
fsrv->uses_crash_exitcode = false;
|
fsrv->uses_crash_exitcode = false;
|
||||||
fsrv->uses_asan = false;
|
fsrv->uses_asan = false;
|
||||||
|
|
||||||
@ -117,6 +117,7 @@ void afl_fsrv_init_dup(afl_forkserver_t *fsrv_to, afl_forkserver_t *from) {
|
|||||||
fsrv_to->uses_crash_exitcode = from->uses_crash_exitcode;
|
fsrv_to->uses_crash_exitcode = from->uses_crash_exitcode;
|
||||||
fsrv_to->crash_exitcode = from->crash_exitcode;
|
fsrv_to->crash_exitcode = from->crash_exitcode;
|
||||||
fsrv_to->kill_signal = from->kill_signal;
|
fsrv_to->kill_signal = from->kill_signal;
|
||||||
|
fsrv_to->debug = from->debug;
|
||||||
|
|
||||||
// These are forkserver specific.
|
// These are forkserver specific.
|
||||||
fsrv_to->out_dir_fd = -1;
|
fsrv_to->out_dir_fd = -1;
|
||||||
@ -484,7 +485,7 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
|
|||||||
|
|
||||||
/* Set sane defaults for ASAN if nothing else specified. */
|
/* Set sane defaults for ASAN if nothing else specified. */
|
||||||
|
|
||||||
if (!getenv("ASAN_OPTIONS"))
|
if (fsrv->debug == true && !getenv("ASAN_OPTIONS"))
|
||||||
setenv("ASAN_OPTIONS",
|
setenv("ASAN_OPTIONS",
|
||||||
"abort_on_error=1:"
|
"abort_on_error=1:"
|
||||||
"detect_leaks=0:"
|
"detect_leaks=0:"
|
||||||
@ -500,7 +501,7 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
|
|||||||
|
|
||||||
/* Set sane defaults for UBSAN if nothing else specified. */
|
/* Set sane defaults for UBSAN if nothing else specified. */
|
||||||
|
|
||||||
if (!getenv("UBSAN_OPTIONS"))
|
if (fsrv->debug == true && !getenv("UBSAN_OPTIONS"))
|
||||||
setenv("UBSAN_OPTIONS",
|
setenv("UBSAN_OPTIONS",
|
||||||
"halt_on_error=1:"
|
"halt_on_error=1:"
|
||||||
"abort_on_error=1:"
|
"abort_on_error=1:"
|
||||||
@ -517,7 +518,7 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
|
|||||||
/* MSAN is tricky, because it doesn't support abort_on_error=1 at this
|
/* MSAN is tricky, because it doesn't support abort_on_error=1 at this
|
||||||
point. So, we do this in a very hacky way. */
|
point. So, we do this in a very hacky way. */
|
||||||
|
|
||||||
if (!getenv("MSAN_OPTIONS"))
|
if (fsrv->debug == true && !getenv("MSAN_OPTIONS"))
|
||||||
setenv("MSAN_OPTIONS",
|
setenv("MSAN_OPTIONS",
|
||||||
"exit_code=" STRINGIFY(MSAN_ERROR) ":"
|
"exit_code=" STRINGIFY(MSAN_ERROR) ":"
|
||||||
"symbolize=0:"
|
"symbolize=0:"
|
||||||
|
@ -339,6 +339,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
afl_state_init(afl, map_size);
|
afl_state_init(afl, map_size);
|
||||||
afl->debug = debug;
|
afl->debug = debug;
|
||||||
afl_fsrv_init(&afl->fsrv);
|
afl_fsrv_init(&afl->fsrv);
|
||||||
|
if (debug) { afl->fsrv.debug = true ; }
|
||||||
|
|
||||||
read_afl_environment(afl, envp);
|
read_afl_environment(afl, envp);
|
||||||
if (afl->shm.map_size) { afl->fsrv.map_size = afl->shm.map_size; }
|
if (afl->shm.map_size) { afl->fsrv.map_size = afl->shm.map_size; }
|
||||||
|
Reference in New Issue
Block a user