|
10 | 10 |
|
11 | 11 |
|
12 | 12 | Copyright 2016, 2017 Google Inc. All rights reserved.
|
13 |
| - Copyright 2019-2020 AFLplusplus Project. All rights reserved. |
| 13 | + Copyright 2019-2021 AFLplusplus Project. All rights reserved. |
14 | 14 |
|
15 | 15 | Licensed under the Apache License, Version 2.0 (the "License");
|
16 | 16 | you may not use this file except in compliance with the License.
|
17 | 17 | You may obtain a copy of the License at:
|
18 | 18 |
|
19 |
| - http://www.apache.org/licenses/LICENSE-2.0 |
| 19 | + https://www.apache.org/licenses/LICENSE-2.0 |
20 | 20 |
|
21 | 21 | */
|
22 | 22 |
|
23 | 23 | #ifndef _HAVE_CONFIG_H
|
24 | 24 | #define _HAVE_CONFIG_H
|
25 | 25 |
|
26 |
| -#include "types.h" |
27 |
| - |
28 | 26 | /* Version string: */
|
29 | 27 |
|
30 |
| -// c = release, d = volatile github dev, e = experimental branch |
31 |
| -#define VERSION "++2.66d" |
| 28 | +// c = release, a = volatile github dev, e = experimental branch |
| 29 | +#define VERSION "++3.15a" |
32 | 30 |
|
33 | 31 | /******************************************************
|
34 | 32 | * *
|
35 | 33 | * Settings that may be of interest to power users: *
|
36 | 34 | * *
|
37 | 35 | ******************************************************/
|
38 | 36 |
|
| 37 | +/* Default shared memory map size. Most targets just need a coverage map |
| 38 | + between 20-250kb. Plus there is an auto-detection feature in afl-fuzz. |
| 39 | + However if a target has problematic constructors and init arrays then |
| 40 | + this can fail. Hence afl-fuzz deploys a larger default map. The largest |
| 41 | + map seen so far is the xlsx fuzzer for libreoffice which is 5MB. |
| 42 | + At runtime this value can be overriden via AFL_MAP_SIZE. |
| 43 | + Default: 8MB (defined in bytes) */ |
| 44 | +#define DEFAULT_SHMEM_SIZE (8 * 1024 * 1024) |
| 45 | + |
| 46 | +/* Default file permission umode when creating files (default: 0600) */ |
| 47 | +#define DEFAULT_PERMISSION 0600 |
| 48 | + |
| 49 | +/* CMPLOG/REDQUEEN TUNING |
| 50 | + * |
| 51 | + * Here you can modify tuning and solving options for CMPLOG. |
| 52 | + * Note that these are run-time options for afl-fuzz, no target |
| 53 | + * recompilation required. |
| 54 | + * |
| 55 | + */ |
| 56 | + |
| 57 | +/* if TRANSFORM is enabled with '-l T', this additionally enables base64 |
| 58 | + encoding/decoding */ |
| 59 | +// #define CMPLOG_SOLVE_TRANSFORM_BASE64 |
| 60 | + |
| 61 | +/* If a redqueen pass finds more than one solution, try to combine them? */ |
| 62 | +#define CMPLOG_COMBINE |
| 63 | + |
| 64 | +/* Minimum % of the corpus to perform cmplog on. Default: 10% */ |
| 65 | +#define CMPLOG_CORPUS_PERCENT 5U |
| 66 | + |
| 67 | +/* Number of potential positions from which we decide if cmplog becomes |
| 68 | + useless, default 8096 */ |
| 69 | +#define CMPLOG_POSITIONS_MAX (12 * 1024) |
| 70 | + |
| 71 | +/* Maximum allowed fails per CMP value. Default: 128 */ |
| 72 | +#define CMPLOG_FAIL_MAX 96 |
| 73 | + |
| 74 | +/* -------------------------------------*/ |
| 75 | +/* Now non-cmplog configuration options */ |
| 76 | +/* -------------------------------------*/ |
| 77 | + |
| 78 | +/* If a persistent target keeps state and found crashes are not reproducable |
| 79 | + then enable this option and set the AFL_PERSISTENT_RECORD env variable |
| 80 | + to a number. These number of testcases prior and including the crash case |
| 81 | + will be kept and written to the crash/ directory as RECORD:... files. |
| 82 | + Note that every crash will be written, not only unique ones! */ |
| 83 | + |
| 84 | +//#define AFL_PERSISTENT_RECORD |
| 85 | + |
| 86 | +/* console output colors: There are three ways to configure its behavior |
| 87 | + * 1. default: colored outputs fixed on: defined USE_COLOR && defined |
| 88 | + * ALWAYS_COLORED The env var. AFL_NO_COLOR will have no effect |
| 89 | + * 2. defined USE_COLOR && !defined ALWAYS_COLORED |
| 90 | + * -> depending on env var AFL_NO_COLOR=1 colors can be switched off |
| 91 | + * at run-time. Default is to use colors. |
| 92 | + * 3. colored outputs fixed off: !defined USE_COLOR |
| 93 | + * The env var. AFL_NO_COLOR will have no effect |
| 94 | + */ |
| 95 | + |
39 | 96 | /* Comment out to disable terminal colors (note that this makes afl-analyze
|
40 | 97 | a lot less nice): */
|
41 | 98 |
|
42 | 99 | #define USE_COLOR
|
43 | 100 |
|
| 101 | +#ifdef USE_COLOR |
| 102 | + /* Comment in to always enable terminal colors */ |
| 103 | + /* Comment out to enable runtime controlled terminal colors via AFL_NO_COLOR |
| 104 | + */ |
| 105 | + #define ALWAYS_COLORED 1 |
| 106 | +#endif |
| 107 | + |
| 108 | +/* StatsD config |
| 109 | + Config can be adjusted via AFL_STATSD_HOST and AFL_STATSD_PORT environment |
| 110 | + variable. |
| 111 | +*/ |
| 112 | +#define STATSD_UPDATE_SEC 1 |
| 113 | +#define STATSD_DEFAULT_PORT 8125 |
| 114 | +#define STATSD_DEFAULT_HOST "127.0.0.1" |
| 115 | + |
44 | 116 | /* If you want to have the original afl internal memory corruption checks.
|
45 | 117 | Disabled by default for speed. it is better to use "make ASAN_BUILD=1". */
|
46 | 118 |
|
47 |
| -//#define _WANT_ORIGINAL_AFL_ALLOC |
| 119 | +// #define _WANT_ORIGINAL_AFL_ALLOC |
48 | 120 |
|
49 | 121 | /* Comment out to disable fancy ANSI boxes and use poor man's 7-bit UI: */
|
50 | 122 |
|
|
55 | 127 | /* Default timeout for fuzzed code (milliseconds). This is the upper bound,
|
56 | 128 | also used for detecting hangs; the actual value is auto-scaled: */
|
57 | 129 |
|
58 |
| -#define EXEC_TIMEOUT 1000 |
| 130 | +#define EXEC_TIMEOUT 1000U |
59 | 131 |
|
60 | 132 | /* Timeout rounding factor when auto-scaling (milliseconds): */
|
61 | 133 |
|
62 |
| -#define EXEC_TM_ROUND 20 |
| 134 | +#define EXEC_TM_ROUND 20U |
63 | 135 |
|
64 | 136 | /* 64bit arch MACRO */
|
65 | 137 | #if (defined(__x86_64__) || defined(__arm64__) || defined(__aarch64__))
|
66 | 138 | #define WORD_SIZE_64 1
|
67 | 139 | #endif
|
68 | 140 |
|
69 |
| -/* Default memory limit for child process (MB): */ |
70 |
| - |
71 |
| -#ifndef __NetBSD__ |
72 |
| - #ifndef WORD_SIZE_64 |
73 |
| - #define MEM_LIMIT 25 |
74 |
| - #else |
75 |
| - #define MEM_LIMIT 50 |
76 |
| - #endif /* ^!WORD_SIZE_64 */ |
77 |
| -#else /* NetBSD's kernel needs more space for stack, see discussion for issue \ |
78 |
| - #165 */ |
79 |
| - #define MEM_LIMIT 200 |
80 |
| -#endif |
81 |
| -/* Default memory limit when running in QEMU mode (MB): */ |
| 141 | +/* Default memory limit for child process (MB) 0 = disabled : */ |
| 142 | + |
| 143 | +#define MEM_LIMIT 0U |
| 144 | + |
| 145 | +/* Default memory limit when running in QEMU mode (MB) 0 = disabled : */ |
82 | 146 |
|
83 |
| -#define MEM_LIMIT_QEMU 200 |
| 147 | +#define MEM_LIMIT_QEMU 0U |
84 | 148 |
|
85 |
| -/* Default memory limit when running in Unicorn mode (MB): */ |
| 149 | +/* Default memory limit when running in Unicorn mode (MB) 0 = disabled : */ |
86 | 150 |
|
87 |
| -#define MEM_LIMIT_UNICORN 200 |
| 151 | +#define MEM_LIMIT_UNICORN 0U |
88 | 152 |
|
89 | 153 | /* Number of calibration cycles per every new test case (and for test
|
90 | 154 | cases that show variable behavior): */
|
91 | 155 |
|
92 |
| -#define CAL_CYCLES 8 |
93 |
| -#define CAL_CYCLES_LONG 40 |
| 156 | +#define CAL_CYCLES 8U |
| 157 | +#define CAL_CYCLES_LONG 20U |
94 | 158 |
|
95 | 159 | /* Number of subsequent timeouts before abandoning an input file: */
|
96 | 160 |
|
97 |
| -#define TMOUT_LIMIT 250 |
| 161 | +#define TMOUT_LIMIT 250U |
98 | 162 |
|
99 | 163 | /* Maximum number of unique hangs or crashes to record: */
|
100 | 164 |
|
101 |
| -#define KEEP_UNIQUE_HANG 500 |
102 |
| -#define KEEP_UNIQUE_CRASH 5000 |
| 165 | +#define KEEP_UNIQUE_HANG 500U |
| 166 | +#define KEEP_UNIQUE_CRASH 10000U |
103 | 167 |
|
104 | 168 | /* Baseline number of random tweaks during a single 'havoc' stage: */
|
105 | 169 |
|
106 |
| -#define HAVOC_CYCLES 256 |
107 |
| -#define HAVOC_CYCLES_INIT 1024 |
| 170 | +#define HAVOC_CYCLES 256U |
| 171 | +#define HAVOC_CYCLES_INIT 1024U |
108 | 172 |
|
109 | 173 | /* Maximum multiplier for the above (should be a power of two, beware
|
110 | 174 | of 32-bit int overflows): */
|
111 | 175 |
|
112 |
| -#define HAVOC_MAX_MULT 16 |
113 |
| -#define HAVOC_MAX_MULT_MOPT 32 |
| 176 | +#define HAVOC_MAX_MULT 64U |
| 177 | +#define HAVOC_MAX_MULT_MOPT 64U |
114 | 178 |
|
115 | 179 | /* Absolute minimum number of havoc cycles (after all adjustments): */
|
116 | 180 |
|
117 |
| -#define HAVOC_MIN 16 |
| 181 | +#define HAVOC_MIN 12U |
118 | 182 |
|
119 | 183 | /* Power Schedule Divisor */
|
120 |
| -#define POWER_BETA 1 |
| 184 | +#define POWER_BETA 1U |
121 | 185 | #define MAX_FACTOR (POWER_BETA * 32)
|
122 | 186 |
|
123 | 187 | /* Maximum stacking for havoc-stage tweaks. The actual value is calculated
|
|
126 | 190 | n = random between 1 and HAVOC_STACK_POW2
|
127 | 191 | stacking = 2^n
|
128 | 192 |
|
129 |
| - In other words, the default (n = 7) produces 2, 4, 8, 16, 32, 64, or |
130 |
| - 128 stacked tweaks: */ |
| 193 | + In other words, the default (n = 4) produces 2, 4, 8, 16 |
| 194 | + stacked tweaks: */ |
131 | 195 |
|
132 |
| -#define HAVOC_STACK_POW2 7 |
| 196 | +#define HAVOC_STACK_POW2 4U |
133 | 197 |
|
134 | 198 | /* Caps on block sizes for cloning and deletion operations. Each of these
|
135 | 199 | ranges has a 33% probability of getting picked, except for the first
|
136 | 200 | two cycles where smaller blocks are favored: */
|
137 | 201 |
|
138 |
| -#define HAVOC_BLK_SMALL 32 |
139 |
| -#define HAVOC_BLK_MEDIUM 128 |
140 |
| -#define HAVOC_BLK_LARGE 1500 |
| 202 | +#define HAVOC_BLK_SMALL 32U |
| 203 | +#define HAVOC_BLK_MEDIUM 128U |
| 204 | +#define HAVOC_BLK_LARGE 1500U |
141 | 205 |
|
142 | 206 | /* Extra-large blocks, selected very rarely (<5% of the time): */
|
143 | 207 |
|
144 |
| -#define HAVOC_BLK_XL 32768 |
| 208 | +#define HAVOC_BLK_XL 32768U |
145 | 209 |
|
146 | 210 | /* Probabilities of skipping non-favored entries in the queue, expressed as
|
147 | 211 | percentages: */
|
|
169 | 233 | #define TRIM_START_STEPS 16
|
170 | 234 | #define TRIM_END_STEPS 1024
|
171 | 235 |
|
172 |
| -/* Maximum size of input file, in bytes (keep under 100MB): */ |
| 236 | +/* Maximum size of input file, in bytes (keep under 100MB, default 1MB): |
| 237 | + (note that if this value is changed, several areas in afl-cc.c, afl-fuzz.c |
| 238 | + and afl-fuzz-state.c have to be changed as well! */ |
173 | 239 |
|
174 |
| -#define MAX_FILE (1 * 1024 * 1024) |
| 240 | +#define MAX_FILE (1 * 1024 * 1024L) |
175 | 241 |
|
176 | 242 | /* The same, for the test case minimizer: */
|
177 | 243 |
|
178 |
| -#define TMIN_MAX_FILE (10 * 1024 * 1024) |
| 244 | +#define TMIN_MAX_FILE (10 * 1024 * 1024L) |
179 | 245 |
|
180 | 246 | /* Block normalization steps for afl-tmin: */
|
181 | 247 |
|
|
195 | 261 | steps; past this point, the "extras/user" step will be still carried out,
|
196 | 262 | but with proportionally lower odds: */
|
197 | 263 |
|
198 |
| -#define MAX_DET_EXTRAS 200 |
| 264 | +#define MAX_DET_EXTRAS 256 |
199 | 265 |
|
200 | 266 | /* Maximum number of auto-extracted dictionary tokens to actually use in fuzzing
|
201 | 267 | (first value), and to keep in memory as candidates. The latter should be much
|
202 | 268 | higher than the former. */
|
203 | 269 |
|
204 |
| -#define USE_AUTO_EXTRAS 128 |
205 |
| -#define MAX_AUTO_EXTRAS (USE_AUTO_EXTRAS * 64) |
| 270 | +#define USE_AUTO_EXTRAS 4096 |
| 271 | +#define MAX_AUTO_EXTRAS (USE_AUTO_EXTRAS * 8) |
206 | 272 |
|
207 | 273 | /* Scaling factor for the effector map used to skip some of the more
|
208 | 274 | expensive deterministic steps. The actual divisor is set to
|
|
236 | 302 |
|
237 | 303 | #define SYNC_INTERVAL 8
|
238 | 304 |
|
| 305 | +/* Sync time (minimum time between syncing in ms, time is halfed for -M main |
| 306 | + nodes) - default is 30 minutes: */ |
| 307 | + |
| 308 | +#define SYNC_TIME (30 * 60 * 1000) |
| 309 | + |
239 | 310 | /* Output directory reuse grace period (minutes): */
|
240 | 311 |
|
241 | 312 | #define OUTPUT_GRACE 25
|
|
295 | 366 |
|
296 | 367 | #define RESEED_RNG 100000
|
297 | 368 |
|
| 369 | +/* The default maximum testcase cache size in MB, 0 = disable. |
| 370 | + A value between 50 and 250 is a good default value. Note that the |
| 371 | + number of entries will be auto assigned if not specified via the |
| 372 | + AFL_TESTCACHE_ENTRIES env variable */ |
| 373 | + |
| 374 | +#define TESTCASE_CACHE_SIZE 50 |
| 375 | + |
298 | 376 | /* Maximum line length passed from GCC to 'as' and used for parsing
|
299 | 377 | configuration files: */
|
300 | 378 |
|
|
328 | 406 |
|
329 | 407 | #define MSAN_ERROR 86
|
330 | 408 |
|
| 409 | +/* Distinctive exit code used to indicate LSAN trip condition: */ |
| 410 | + |
| 411 | +#define LSAN_ERROR 23 |
| 412 | + |
331 | 413 | /* Designated file descriptors for forkserver commands (the application will
|
332 | 414 | use FORKSRV_FD and FORKSRV_FD + 1): */
|
333 | 415 |
|
|
356 | 438 | after changing this - otherwise, SEGVs may ensue. */
|
357 | 439 |
|
358 | 440 | #define MAP_SIZE_POW2 16
|
359 |
| -#define MAP_SIZE (1 << MAP_SIZE_POW2) |
| 441 | +#define MAP_SIZE (1U << MAP_SIZE_POW2) |
360 | 442 |
|
361 | 443 | /* Maximum allocator request size (keep well under INT_MAX): */
|
362 | 444 |
|
|
0 commit comments