aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2024-06-18 15:24:38 +0200
committervanhauser-thc <vh@thc.org>2024-06-18 15:24:38 +0200
commit304e84502d9bd8a5ac33328ceb63235f42b887ad (patch)
treec22a9536a67813ea1830626b565b8b5d8d04bbb8 /src
parentdd762726dc7055f4b1c48da2ee1b22ff6fdde35e (diff)
downloadafl++-304e84502d9bd8a5ac33328ceb63235f42b887ad.tar.gz
fast resume option
Diffstat (limited to 'src')
-rw-r--r--src/afl-fuzz-state.c7
-rw-r--r--src/afl-fuzz.c12
2 files changed, 17 insertions, 2 deletions
diff --git a/src/afl-fuzz-state.c b/src/afl-fuzz-state.c
index fbe6d32a..dd684a19 100644
--- a/src/afl-fuzz-state.c
+++ b/src/afl-fuzz-state.c
@@ -286,6 +286,13 @@ void read_afl_environment(afl_state_t *afl, char **envp) {
afl->afl_env.afl_no_sync =
get_afl_env(afl_environment_variables[i]) ? 1 : 0;
+ } else if (!strncmp(env, "AFL_NO_FASTRESUME",
+
+ afl_environment_variable_len)) {
+
+ afl->afl_env.afl_no_fastresume =
+ 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 d8be5721..8fd3a407 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -335,6 +335,7 @@ static void usage(u8 *argv0, int more_help) {
"AFL_STATSD_PORT: change default statsd port (default: 8125)\n"
"AFL_STATSD_TAGS_FLAVOR: set statsd tags format (default: disable tags)\n"
" suported formats: dogstatsd, librato, signalfx, influxdb\n"
+ "AFL_NO_FASTRESUME: do not read or write a fast resume file\n"
"AFL_NO_SYNC: disables all syncing\n"
"AFL_SYNC_TIME: sync time between fuzzing instances (in minutes)\n"
"AFL_FINAL_SYNC: sync a final time when exiting (will delay the exit!)\n"
@@ -2107,7 +2108,7 @@ int main(int argc, char **argv_orig, char **envp) {
u64 prev_target_hash = 0;
s32 fast_resume = 0, fr_fd = -1;
- if (afl->in_place_resume) {
+ if (afl->in_place_resume && !afl->afl_env.afl_no_fastresume) {
u8 fn[PATH_MAX], buf[32];
snprintf(fn, PATH_MAX, "%s/target_hash", afl->out_dir);
@@ -2128,7 +2129,7 @@ int main(int argc, char **argv_orig, char **envp) {
write_setup_file(afl, argc, argv);
- if (afl->in_place_resume) {
+ if (afl->in_place_resume && !afl->afl_env.afl_no_fastresume) {
u64 target_hash = get_binary_hash(afl->fsrv.target_path);
@@ -2166,6 +2167,10 @@ int main(int argc, char **argv_orig, char **envp) {
}
+ // If the fast resume file is not valid we will be unable to start, so
+ // we remove the file but keep the file descriptor open.
+ unlink(fn);
+
}
}
@@ -3204,9 +3209,11 @@ stop_fuzzing:
fclose(afl->fsrv.det_plot_file);
#endif
+ if (!afl->afl_env.afl_no_fastresume) {
/* create fastresume.bin */
u8 fr[PATH_MAX];
snprintf(fr, PATH_MAX, "%s/fastresume.bin", afl->out_dir);
+ ACTF("Writing %s ...", fr);
if ((fr_fd = open(fr, O_WRONLY | O_TRUNC | O_CREAT, DEFAULT_PERMISSION)) >=
0) {
@@ -3260,6 +3267,7 @@ stop_fuzzing:
WARNF("Could not create fastresume.bin");
}
+ }
destroy_queue(afl);
destroy_extras(afl);