mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 02:58:08 +00:00
Add AFL_SYNC_TIME variable for synchronization time tuning (#1425)
* Add AFL_SYNC_TIME variable for synchronization time tuning * Documentation for AFL_SYNC_TIME variable
This commit is contained in:
@ -517,6 +517,10 @@ checks or alter some of the more exotic semantics of the tool:
|
|||||||
(empty/non present) will add no tags to the metrics. For more information,
|
(empty/non present) will add no tags to the metrics. For more information,
|
||||||
see [rpc_statsd.md](rpc_statsd.md).
|
see [rpc_statsd.md](rpc_statsd.md).
|
||||||
|
|
||||||
|
- `AFL_SYNC_TIME` allows you to specify a different minimal time (in minutes)
|
||||||
|
between fuzzing instances synchronization. Default sync time is 30 minutes,
|
||||||
|
note that time is halfed for -M main nodes.
|
||||||
|
|
||||||
- Setting `AFL_TARGET_ENV` causes AFL++ to set extra environment variables for
|
- Setting `AFL_TARGET_ENV` causes AFL++ to set extra environment variables for
|
||||||
the target binary. Example: `AFL_TARGET_ENV="VAR1=1 VAR2='a b c'" afl-fuzz
|
the target binary. Example: `AFL_TARGET_ENV="VAR1=1 VAR2='a b c'" afl-fuzz
|
||||||
... `. This exists mostly for things like `LD_LIBRARY_PATH` but it would
|
... `. This exists mostly for things like `LD_LIBRARY_PATH` but it would
|
||||||
|
@ -577,7 +577,8 @@ typedef struct afl_state {
|
|||||||
last_find_time, /* Time for most recent path (ms) */
|
last_find_time, /* Time for most recent path (ms) */
|
||||||
last_crash_time, /* Time for most recent crash (ms) */
|
last_crash_time, /* Time for most recent crash (ms) */
|
||||||
last_hang_time, /* Time for most recent hang (ms) */
|
last_hang_time, /* Time for most recent hang (ms) */
|
||||||
exit_on_time; /* Delay to exit if no new paths */
|
exit_on_time, /* Delay to exit if no new paths */
|
||||||
|
sync_time; /* Sync time (ms) */
|
||||||
|
|
||||||
u32 slowest_exec_ms, /* Slowest testcase non hang in ms */
|
u32 slowest_exec_ms, /* Slowest testcase non hang in ms */
|
||||||
subseq_tmouts; /* Number of timeouts in a row */
|
subseq_tmouts; /* Number of timeouts in a row */
|
||||||
|
@ -206,6 +206,7 @@ static char *afl_environment_variables[] = {
|
|||||||
"AFL_STATSD_HOST",
|
"AFL_STATSD_HOST",
|
||||||
"AFL_STATSD_PORT",
|
"AFL_STATSD_PORT",
|
||||||
"AFL_STATSD_TAGS_FLAVOR",
|
"AFL_STATSD_TAGS_FLAVOR",
|
||||||
|
"AFL_SYNC_TIME",
|
||||||
"AFL_TESTCACHE_SIZE",
|
"AFL_TESTCACHE_SIZE",
|
||||||
"AFL_TESTCACHE_ENTRIES",
|
"AFL_TESTCACHE_ENTRIES",
|
||||||
"AFL_TMIN_EXACT",
|
"AFL_TMIN_EXACT",
|
||||||
|
@ -101,6 +101,7 @@ void afl_state_init(afl_state_t *afl, uint32_t map_size) {
|
|||||||
afl->stats_update_freq = 1;
|
afl->stats_update_freq = 1;
|
||||||
afl->stats_avg_exec = 0;
|
afl->stats_avg_exec = 0;
|
||||||
afl->skip_deterministic = 1;
|
afl->skip_deterministic = 1;
|
||||||
|
afl->sync_time = SYNC_TIME;
|
||||||
afl->cmplog_lvl = 2;
|
afl->cmplog_lvl = 2;
|
||||||
afl->min_length = 1;
|
afl->min_length = 1;
|
||||||
afl->max_length = MAX_FILE;
|
afl->max_length = MAX_FILE;
|
||||||
@ -519,6 +520,17 @@ void read_afl_environment(afl_state_t *afl, char **envp) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (!strncmp(env, "AFL_SYNC_TIME",
|
||||||
|
|
||||||
|
afl_environment_variable_len)) {
|
||||||
|
|
||||||
|
int time = atoi((u8 *)get_afl_env(afl_environment_variables[i]));
|
||||||
|
if (time > 0) {
|
||||||
|
afl->sync_time = time * (60 * 1000LL);
|
||||||
|
} else {
|
||||||
|
WARNF("incorrect value for AFL_SYNC_TIME environment variable, "
|
||||||
|
"used default value %lld instead.", afl->sync_time / 60 / 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -295,6 +295,7 @@ static void usage(u8 *argv0, int more_help) {
|
|||||||
"AFL_STATSD_TAGS_FLAVOR: set statsd tags format (default: disable tags)\n"
|
"AFL_STATSD_TAGS_FLAVOR: set statsd tags format (default: disable tags)\n"
|
||||||
" Supported formats are: 'dogstatsd', 'librato',\n"
|
" Supported formats are: 'dogstatsd', 'librato',\n"
|
||||||
" 'signalfx' and 'influxdb'\n"
|
" 'signalfx' and 'influxdb'\n"
|
||||||
|
"AFL_SYNC_TIME: sync time between fuzzing instances (in minutes)\n"
|
||||||
"AFL_TESTCACHE_SIZE: use a cache for testcases, improves performance (in MB)\n"
|
"AFL_TESTCACHE_SIZE: use a cache for testcases, improves performance (in MB)\n"
|
||||||
"AFL_TMPDIR: directory to use for input file generation (ramdisk recommended)\n"
|
"AFL_TMPDIR: directory to use for input file generation (ramdisk recommended)\n"
|
||||||
"AFL_EARLY_FORKSERVER: force an early forkserver in an afl-clang-fast/\n"
|
"AFL_EARLY_FORKSERVER: force an early forkserver in an afl-clang-fast/\n"
|
||||||
@ -2511,7 +2512,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
if (unlikely(afl->is_main_node)) {
|
if (unlikely(afl->is_main_node)) {
|
||||||
|
|
||||||
if (unlikely(get_cur_time() >
|
if (unlikely(get_cur_time() >
|
||||||
(SYNC_TIME >> 1) + afl->last_sync_time)) {
|
(afl->sync_time >> 1) + afl->last_sync_time)) {
|
||||||
|
|
||||||
if (!(sync_interval_cnt++ % (SYNC_INTERVAL / 3))) {
|
if (!(sync_interval_cnt++ % (SYNC_INTERVAL / 3))) {
|
||||||
|
|
||||||
@ -2523,7 +2524,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (unlikely(get_cur_time() > SYNC_TIME + afl->last_sync_time)) {
|
if (unlikely(get_cur_time() > afl->sync_time + afl->last_sync_time)) {
|
||||||
|
|
||||||
if (!(sync_interval_cnt++ % SYNC_INTERVAL)) { sync_fuzzers(afl); }
|
if (!(sync_interval_cnt++ % SYNC_INTERVAL)) { sync_fuzzers(afl); }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user