aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarc <marc@marc.srlabs.de>2023-08-11 11:22:18 +0200
committermarc <marc@marc.srlabs.de>2023-08-11 11:22:18 +0200
commit8823f22a9c87123c1bfcc5bff10044de4c7a4a1f (patch)
tree58b8b723b333aa0cf10a9d9c7597331ba30ad481
parent1cd9258768253e082baa1cc453c578b373839dbc (diff)
downloadafl++-8823f22a9c87123c1bfcc5bff10044de4c7a4a1f.tar.gz
add AFL_FINAL_SYNC
-rw-r--r--docs/Changelog.md7
-rw-r--r--docs/env_variables.md13
-rw-r--r--include/afl-fuzz.h3
-rw-r--r--include/envs.h1
-rw-r--r--src/afl-fuzz-state.c7
-rw-r--r--src/afl-fuzz.c9
6 files changed, 31 insertions, 9 deletions
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 94b4c502..8f2b2545 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -4,7 +4,9 @@
release of the tool. See README.md for the general instruction manual.
### Version ++4.09a (dev)
- - something cool :-)
+ - afl-fuzz:
+ - added `AFL_FINAL_SYNC` which forces a final fuzzer sync (also for `-F`)
+ before terminating.
### Version ++4.08c (release)
@@ -22,7 +24,6 @@
- -l X option to enable base64 transformation solving
- allow to disable CMPLOG with '-c -' (e.g. afl.rs enforces '-c 0' on
every instance which is counterproductive).
-
- afl-cmin/afl-cmin.bash:
- fixed a bug inherited from vanilla AFL where a coverage of
map[123] = 11 would be the same as map[1123] = 1
@@ -40,7 +41,6 @@
- qemu_mode:
- added qemu_mode/utils/qemu_get_symbol_addr.sh
-
### Version ++4.07c (release)
- afl-fuzz:
- reverse reading the seeds only on restarts (increases performance)
@@ -69,7 +69,6 @@
- TritonDSE in custom_mutators/aflpp_tritondse
- SymQEMU in custom_mutators/symqemu
-
### Version ++4.06c (release)
- afl-fuzz:
- ensure temporary file descriptor is closed when not used
diff --git a/docs/env_variables.md b/docs/env_variables.md
index affc9e3c..2ce274d3 100644
--- a/docs/env_variables.md
+++ b/docs/env_variables.md
@@ -412,10 +412,15 @@ checks or alter some of the more exotic semantics of the tool:
set `AFL_IGNORE_PROBLEMS`. If you additionally want to also ignore coverage
from late loaded libraries, you can set `AFL_IGNORE_PROBLEMS_COVERAGE`.
- - When running in the `-M` or `-S` mode, setting `AFL_IMPORT_FIRST` causes the
- fuzzer to import test cases from other instances before doing anything else.
- This makes the "own finds" counter in the UI more accurate. Beyond counter
- aesthetics, not much else should change.
+ - When running with multiple afl-fuzz or with `-F`, setting `AFL_IMPORT_FIRST`
+ causes the fuzzer to import test cases from other instances before doing
+ anything else. This makes the "own finds" counter in the UI more accurate.
+
+ - When running with multiple afl-fuzz or with `-F`, setting `AFL_FINAL_SYNC`
+ will cause the fuzzer to perform a final import of test cases when
+ terminating. This is beneficial for `-M` main fuzzers to ensure it has all
+ unique test cases and hence you only need to `afl-cmin` this single
+ queue.
- Setting `AFL_INPUT_LEN_MIN` and `AFL_INPUT_LEN_MAX` are an alternative to
the afl-fuzz -g/-G command line option to control the minimum/maximum
diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h
index ef84a18c..1f89bbd8 100644
--- a/include/afl-fuzz.h
+++ b/include/afl-fuzz.h
@@ -402,7 +402,8 @@ typedef struct afl_env_vars {
afl_exit_on_seed_issues, afl_try_affinity, afl_ignore_problems,
afl_keep_timeouts, afl_no_crash_readme, afl_ignore_timeouts,
afl_no_startup_calibration, afl_no_warn_instability,
- afl_post_process_keep_original, afl_crashing_seeds_as_new_crash;
+ afl_post_process_keep_original, afl_crashing_seeds_as_new_crash,
+ afl_final_sync;
u8 *afl_tmpdir, *afl_custom_mutator_library, *afl_python_module, *afl_path,
*afl_hang_tmout, *afl_forksrv_init_tmout, *afl_preload,
diff --git a/include/envs.h b/include/envs.h
index 0007d5a8..3f5a9e1c 100644
--- a/include/envs.h
+++ b/include/envs.h
@@ -59,6 +59,7 @@ static char *afl_environment_variables[] = {
"AFL_EXIT_ON_TIME",
"AFL_EXIT_ON_SEED_ISSUES",
"AFL_FAST_CAL",
+ "AFL_FINAL_SYNC",
"AFL_FORCE_UI",
"AFL_FRIDA_DEBUG_MAPS",
"AFL_FRIDA_DRIVER_NO_HOOK",
diff --git a/src/afl-fuzz-state.c b/src/afl-fuzz-state.c
index 5a6b95cf..97e00415 100644
--- a/src/afl-fuzz-state.c
+++ b/src/afl-fuzz-state.c
@@ -269,6 +269,13 @@ void read_afl_environment(afl_state_t *afl, char **envp) {
afl->afl_env.afl_import_first =
get_afl_env(afl_environment_variables[i]) ? 1 : 0;
+ } else if (!strncmp(env, "AFL_FINAL_SYNC",
+
+ afl_environment_variable_len)) {
+
+ afl->afl_env.afl_final_sync =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
+
} else if (!strncmp(env, "AFL_CUSTOM_MUTATOR_ONLY",
afl_environment_variable_len)) {
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index cdb3f996..c2ec4a1d 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -2899,6 +2899,15 @@ stop_fuzzing:
time_spent_working / afl->fsrv.total_execs);
#endif
+ if (afl->afl_env.afl_final_sync) {
+
+ SAYF(cYEL "[!] " cRST "\nPerforming final sync, this make take some time ...\n");
+ sync_fuzzers(afl);
+ write_bitmap(afl);
+ SAYF(cYEL "[!] " cRST "Done!\n\n");
+
+ }
+
if (afl->is_main_node) {
u8 path[PATH_MAX];