Merge branch 'replay' into tmp

This commit is contained in:
van Hauser
2021-03-24 18:19:13 +01:00
committed by GitHub
8 changed files with 183 additions and 9 deletions

View File

@ -222,6 +222,9 @@ static void usage(u8 *argv0, int more_help) {
"AFL_PATH: path to AFL support binaries\n"
"AFL_PYTHON_MODULE: mutate and trim inputs with the specified Python module\n"
"AFL_QUIET: suppress forkserver status messages\n"
#ifdef AFL_PERSISTENT_RECORD
"AFL_PERSISTENT_RECORD: record the last X inputs to every crash in out/crashes\n"
#endif
"AFL_PRELOAD: LD_PRELOAD / DYLD_INSERT_LIBRARIES settings for target\n"
"AFL_TARGET_ENV: pass extra environment variables to target\n"
"AFL_SHUFFLE_QUEUE: reorder the input queue randomly on startup\n"
@ -253,7 +256,13 @@ static void usage(u8 *argv0, int more_help) {
SAYF("Compiled with %s module support, see docs/custom_mutator.md\n",
(char *)PYTHON_VERSION);
#else
SAYF("Compiled without python module support\n");
SAYF("Compiled without python module support.\n");
#endif
#ifdef AFL_PERSISTENT_RECORD
SAYF("Compiled with AFL_PERSISTENT_RECORD support.\n");
#else
SAYF("Compiled without AFL_PERSISTENT_RECORD support.\n");
#endif
#ifdef USEMMAP
@ -263,27 +272,27 @@ static void usage(u8 *argv0, int more_help) {
#endif
#ifdef ASAN_BUILD
SAYF("Compiled with ASAN_BUILD\n\n");
SAYF("Compiled with ASAN_BUILD.\n");
#endif
#ifdef NO_SPLICING
SAYF("Compiled with NO_SPLICING\n\n");
SAYF("Compiled with NO_SPLICING.\n");
#endif
#ifdef PROFILING
SAYF("Compiled with PROFILING\n\n");
SAYF("Compiled with PROFILING.\n");
#endif
#ifdef INTROSPECTION
SAYF("Compiled with INTROSPECTION\n\n");
SAYF("Compiled with INTROSPECTION.\n");
#endif
#ifdef _DEBUG
SAYF("Compiled with _DEBUG\n\n");
SAYF("Compiled with _DEBUG.\n");
#endif
#ifdef _AFL_DOCUMENT_MUTATIONS
SAYF("Compiled with _AFL_DOCUMENT_MUTATIONS\n\n");
SAYF("Compiled with _AFL_DOCUMENT_MUTATIONS.\n");
#endif
SAYF("For additional help please consult %s/README.md :)\n\n", doc_path);
@ -1023,6 +1032,28 @@ int main(int argc, char **argv_orig, char **envp) {
}
if (unlikely(afl->afl_env.afl_persistent_record)) {
#ifdef AFL_PERSISTENT_RECORD
afl->fsrv.persistent_record = atoi(afl->afl_env.afl_persistent_record);
if (afl->fsrv.persistent_record < 2) {
FATAL(
"AFL_PERSISTENT_RECORD value must be be at least 2, recommended is "
"100 or 1000.");
}
#else
FATAL("afl-fuzz was not compiled with AFL_PERSISTENT_RECORD enabled in config.h!");
#endif
}
if (afl->fsrv.mem_limit && afl->shm.cmplog_mode) afl->fsrv.mem_limit += 260;
OKF("afl++ is maintained by Marc \"van Hauser\" Heuse, Heiko \"hexcoder\" "
@ -1489,6 +1520,20 @@ int main(int argc, char **argv_orig, char **envp) {
check_binary(afl, argv[optind]);
if (unlikely(afl->fsrv.persistent_record)) {
if (!getenv(PERSIST_ENV_VAR)) {
FATAL(
"Target binary is not compiled in persistent mode, "
"AFL_PERSISTENT_RECORD makes no sense.");
}
afl->fsrv.persistent_record_dir = alloc_printf("%s/crashes", afl->out_dir);
}
if (afl->shmem_testcase_mode) { setup_testcase_shmem(afl); }
afl->start_time = get_cur_time();