check for minimum cache size

This commit is contained in:
van Hauser 2020-10-14 17:32:51 +02:00
parent 23872d6f2c
commit 735e8c3956
2 changed files with 17 additions and 6 deletions

View File

@ -1165,7 +1165,7 @@ void queue_testcase_retake(afl_state_t *afl, struct queue_entry *q,
u32 old_len);
#if TESTCASE_CACHE == 1
#error define of TESTCASE_CACHE must be zero or larger than 1
#error define of TESTCASE_CACHE must be zero or larger than 1
#endif
#endif

View File

@ -200,8 +200,8 @@ static void usage(u8 *argv0, int more_help) {
"AFL_STATSD_HOST: change default statsd host (default 127.0.0.1)\n"
"AFL_STATSD_PORT: change default statsd port (default: 8125)\n"
"AFL_STATSD_TAGS_FLAVOR: set statsd tags format (default: disable tags)\n"
" Supported formats are: 'dogstatsd', 'librato', 'signalfx'\n"
" and 'influxdb'\n"
" Supported formats are: 'dogstatsd', 'librato',\n"
" 'signalfx' and 'influxdb'\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_PERSISTENT: not supported anymore -> no effect, just a warning\n"
@ -1012,15 +1012,26 @@ int main(int argc, char **argv_orig, char **envp) {
afl->q_testcase_max_cache_size =
(u64)atoi(afl->afl_env.afl_testcache_size) * 1024000;
OKF("Enabled testcache with %llu MB",
afl->q_testcase_max_cache_size / 1024000);
} else {
}
if (!afl->q_testcase_max_cache_size) {
ACTF(
"No testcache was configured. it is recommended to use a testcache, it "
"improves performance: set AFL_TESTCACHE_SIZE=(value in MB)");
} else if (afl->q_testcase_max_cache_size < 2 * MAX_FILE) {
FATAL("AFL_TESTCACHE_SIZE must be set to %u or more, or 0 to disable",
(2 * MAX_FILE) % 1024000 ? 1 + ((2 * MAX_FILE) / 1024000)
: (2 * MAX_FILE) / 1024000);
} else {
OKF("Enabled testcache with %llu MB",
afl->q_testcase_max_cache_size / 1024000);
}
if (afl->afl_env.afl_forksrv_init_tmout) {