Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: third_party/afl/src/config.h

Issue 2075883002: Add American Fuzzy Lop (afl) to third_party/afl/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/afl/src/alloc-inl.h ('k') | third_party/afl/src/debug.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 american fuzzy lop - vaguely configurable bits
3 ----------------------------------------------
4
5 Written and maintained by Michal Zalewski <lcamtuf@google.com>
6
7 Copyright 2013, 2014, 2015, 2016 Google Inc. All rights reserved.
8
9 Licensed under the Apache License, Version 2.0 (the "License");
10 you may not use this file except in compliance with the License.
11 You may obtain a copy of the License at:
12
13 http://www.apache.org/licenses/LICENSE-2.0
14
15 */
16
17 #ifndef _HAVE_CONFIG_H
18 #define _HAVE_CONFIG_H
19
20 #include "types.h"
21
22 /******************************************************
23 * *
24 * Settings that may be of interest to power users: *
25 * *
26 ******************************************************/
27
28 /* Comment out to disable terminal colors (note that this makes afl-analyze
29 a lot less nice): */
30
31 #define USE_COLOR
32
33 /* Comment out to disable fancy ANSI boxes and use poor man's 7-bit UI: */
34
35 #define FANCY_BOXES
36
37 /* Default timeout for fuzzed code (milliseconds): */
38
39 #define EXEC_TIMEOUT 1000
40
41 /* Timeout rounding factor when auto-scaling (milliseconds): */
42
43 #define EXEC_TM_ROUND 20
44
45 /* Default memory limit for child process (MB): */
46
47 #ifndef __x86_64__
48 # define MEM_LIMIT 25
49 #else
50 # define MEM_LIMIT 50
51 #endif /* ^!__x86_64__ */
52
53 /* Default memory limit when running in QEMU mode (MB): */
54
55 #define MEM_LIMIT_QEMU 200
56
57 /* Number of calibration cycles per every new test case (and for test
58 cases that show variable behavior): */
59
60 #define CAL_CYCLES 10
61 #define CAL_CYCLES_LONG 40
62
63 /* The same, but when AFL_NO_VAR_CHECK is set in the environment: */
64
65 #define CAL_CYCLES_NO_VAR 4
66
67 /* Number of subsequent hangs before abandoning an input file: */
68
69 #define HANG_LIMIT 250
70
71 /* Maximum number of unique hangs or crashes to record: */
72
73 #define KEEP_UNIQUE_HANG 500
74 #define KEEP_UNIQUE_CRASH 5000
75
76 /* Baseline number of random tweaks during a single 'havoc' stage: */
77
78 #define HAVOC_CYCLES 5000
79
80 /* Maximum multiplier for the above (should be a power of two, beware
81 of 32-bit int overflows): */
82
83 #define HAVOC_MAX_MULT 16
84
85 /* Absolute minimum number of havoc cycles (after all adjustments): */
86
87 #define HAVOC_MIN 10
88
89 /* Maximum stacking for havoc-stage tweaks. The actual value is calculated
90 like this:
91
92 n = random between 1 and HAVOC_STACK_POW2
93 stacking = 2^n
94
95 In other words, the default (n = 7) produces 2, 4, 8, 16, 32, 64, or
96 128 stacked tweaks: */
97
98 #define HAVOC_STACK_POW2 7
99
100 /* Caps on block sizes for cloning and deletion operations. Each of these
101 ranges has a 33% probability of getting picked, except for the first
102 two cycles where smaller blocks are favored: */
103
104 #define HAVOC_BLK_SMALL 32
105 #define HAVOC_BLK_MEDIUM 128
106 #define HAVOC_BLK_LARGE 1500
107
108 /* Probabilities of skipping non-favored entries in the queue, expressed as
109 percentages: */
110
111 #define SKIP_TO_NEW_PROB 99 /* ...when there are new, pending favorites */
112 #define SKIP_NFAV_OLD_PROB 95 /* ...no new favs, cur entry already fuzzed */
113 #define SKIP_NFAV_NEW_PROB 75 /* ...no new favs, cur entry not fuzzed yet */
114
115 /* Splicing cycle count: */
116
117 #define SPLICE_CYCLES 20
118
119 /* Nominal per-splice havoc cycle length: */
120
121 #define SPLICE_HAVOC 500
122
123 /* Maximum offset for integer addition / subtraction stages: */
124
125 #define ARITH_MAX 35
126
127 /* Limits for the test case trimmer. The absolute minimum chunk size; and
128 the starting and ending divisors for chopping up the input file: */
129
130 #define TRIM_MIN_BYTES 4
131 #define TRIM_START_STEPS 16
132 #define TRIM_END_STEPS 1024
133
134 /* Maximum size of input file, in bytes (keep under 100MB): */
135
136 #define MAX_FILE (1 * 1024 * 1024)
137
138 /* The same, for the test case minimizer: */
139
140 #define TMIN_MAX_FILE (10 * 1024 * 1024)
141
142 /* Block normalization steps for afl-tmin: */
143
144 #define TMIN_SET_MIN_SIZE 4
145 #define TMIN_SET_STEPS 128
146
147 /* Maximum dictionary token size (-x), in bytes: */
148
149 #define MAX_DICT_FILE 128
150
151 /* Length limits for auto-detected dictionary tokens: */
152
153 #define MIN_AUTO_EXTRA 3
154 #define MAX_AUTO_EXTRA 32
155
156 /* Maximum number of user-specified dictionary tokens to use in deterministic
157 steps; past this point, the "extras/user" step will be still carried out,
158 but with proportionally lower odds: */
159
160 #define MAX_DET_EXTRAS 200
161
162 /* Maximum number of auto-extracted dictionary tokens to actually use in fuzzing
163 (first value), and to keep in memory as candidates. The latter should be much
164 higher than the former. */
165
166 #define USE_AUTO_EXTRAS 50
167 #define MAX_AUTO_EXTRAS (USE_AUTO_EXTRAS * 10)
168
169 /* Scaling factor for the effector map used to skip some of the more
170 expensive deterministic steps. The actual divisor is set to
171 2^EFF_MAP_SCALE2 bytes: */
172
173 #define EFF_MAP_SCALE2 3
174
175 /* Minimum input file length at which the effector logic kicks in: */
176
177 #define EFF_MIN_LEN 128
178
179 /* Maximum effector density past which everything is just fuzzed
180 unconditionally (%): */
181
182 #define EFF_MAX_PERC 90
183
184 /* UI refresh frequency (Hz): */
185
186 #define UI_TARGET_HZ 5
187
188 /* Fuzzer stats file and plot update intervals (sec): */
189
190 #define STATS_UPDATE_SEC 60
191 #define PLOT_UPDATE_SEC 5
192
193 /* Smoothing divisor for CPU load and exec speed stats (1 - no smoothing). */
194
195 #define AVG_SMOOTHING 16
196
197 /* Sync interval (every n havoc cycles): */
198
199 #define SYNC_INTERVAL 5
200
201 /* Output directory reuse grace period (minutes): */
202
203 #define OUTPUT_GRACE 25
204
205 /* Uncomment to use simple file names (id_NNNNNN): */
206
207 // #define SIMPLE_FILES
208
209 /* List of interesting values to use in fuzzing. */
210
211 #define INTERESTING_8 \
212 -128, /* Overflow signed 8-bit when decremented */ \
213 -1, /* */ \
214 0, /* */ \
215 1, /* */ \
216 16, /* One-off with common buffer size */ \
217 32, /* One-off with common buffer size */ \
218 64, /* One-off with common buffer size */ \
219 100, /* One-off with common buffer size */ \
220 127 /* Overflow signed 8-bit when incremented */
221
222 #define INTERESTING_16 \
223 -32768, /* Overflow signed 16-bit when decremented */ \
224 -129, /* Overflow signed 8-bit */ \
225 128, /* Overflow signed 8-bit */ \
226 255, /* Overflow unsig 8-bit when incremented */ \
227 256, /* Overflow unsig 8-bit */ \
228 512, /* One-off with common buffer size */ \
229 1000, /* One-off with common buffer size */ \
230 1024, /* One-off with common buffer size */ \
231 4096, /* One-off with common buffer size */ \
232 32767 /* Overflow signed 16-bit when incremented */
233
234 #define INTERESTING_32 \
235 -2147483648LL, /* Overflow signed 32-bit when decremented */ \
236 -100663046, /* Large negative number (endian-agnostic) */ \
237 -32769, /* Overflow signed 16-bit */ \
238 32768, /* Overflow signed 16-bit */ \
239 65535, /* Overflow unsig 16-bit when incremented */ \
240 65536, /* Overflow unsig 16 bit */ \
241 100663045, /* Large positive number (endian-agnostic) */ \
242 2147483647 /* Overflow signed 32-bit when incremented */
243
244 /***********************************************************
245 * *
246 * Really exotic stuff you probably don't want to touch: *
247 * *
248 ***********************************************************/
249
250 /* Call count interval between reseeding the libc PRNG from /dev/urandom: */
251
252 #define RESEED_RNG 10000
253
254 /* Maximum line length passed from GCC to 'as' and used for parsing
255 configuration files: */
256
257 #define MAX_LINE 8192
258
259 /* Environment variable used to pass SHM ID to the called program. */
260
261 #define SHM_ENV_VAR "__AFL_SHM_ID"
262
263 /* Other less interesting, internal-only variables. */
264
265 #define CLANG_ENV_VAR "__AFL_CLANG_MODE"
266 #define AS_LOOP_ENV_VAR "__AFL_AS_LOOPCHECK"
267 #define PERSIST_ENV_VAR "__AFL_PERSISTENT"
268 #define DEFER_ENV_VAR "__AFL_DEFER_FORKSRV"
269
270 /* In-code signatures for deferred and persistent mode. */
271
272 #define PERSIST_SIG "##SIG_AFL_PERSISTENT##"
273 #define DEFER_SIG "##SIG_AFL_DEFER_FORKSRV##"
274
275 /* Distinctive bitmap signature used to indicate failed execution: */
276
277 #define EXEC_FAIL_SIG 0xfee1dead
278
279 /* Distinctive exit code used to indicate MSAN trip condition: */
280
281 #define MSAN_ERROR 86
282
283 /* Designated file descriptors for forkserver commands (the application will
284 use FORKSRV_FD and FORKSRV_FD + 1): */
285
286 #define FORKSRV_FD 198
287
288 /* Fork server init timeout multiplier: we'll wait the user-selected
289 timeout plus this much for the fork server to spin up. */
290
291 #define FORK_WAIT_MULT 10
292
293 /* Calibration timeout adjustments, to be a bit more generous when resuming
294 fuzzing sessions or trying to calibrate already-added internal finds.
295 The first value is a percentage, the other is in milliseconds: */
296
297 #define CAL_TMOUT_PERC 125
298 #define CAL_TMOUT_ADD 50
299
300 /* Number of chances to calibrate a case before giving up: */
301
302 #define CAL_CHANCES 3
303
304 /* Map size for the traced binary (2^MAP_SIZE_POW2). Must be greater than
305 2; you probably want to keep it under 18 or so for performance reasons
306 (adjusting AFL_INST_RATIO when compiling is probably a better way to solve
307 problems with complex programs). You need to recompile the target binary
308 after changing this - otherwise, SEGVs may ensue. */
309
310 #define MAP_SIZE_POW2 16
311 #define MAP_SIZE (1 << MAP_SIZE_POW2)
312
313 /* Maximum allocator request size (keep well under INT_MAX): */
314
315 #define MAX_ALLOC 0x40000000
316
317 /* A made-up hashing seed: */
318
319 #define HASH_CONST 0xa5b35705
320
321 /* Constants for afl-gotcpu to control busy loop timing: */
322
323 #define CTEST_TARGET_MS 5000
324 #define CTEST_CORE_TRG_MS 1000
325 #define CTEST_BUSY_CYCLES (10 * 1000 * 1000)
326
327 /* Uncomment this to use inferior block-coverage-based instrumentation. Note
328 that you need to recompile the target binary for this to have any effect: */
329
330 // #define COVERAGE_ONLY
331
332 /* Uncomment this to ignore hit counts and output just one bit per tuple.
333 As with the previous setting, you will need to recompile the target
334 binary: */
335
336 // #define SKIP_COUNTS
337
338 /* Uncomment this to use instrumentation data to record newly discovered paths,
339 but do not use them as seeds for fuzzing. This is useful for conveniently
340 measuring coverage that could be attained by a "dumb" fuzzing algorithm: */
341
342 // #define IGNORE_FINDS
343
344 #endif /* ! _HAVE_CONFIG_H */
OLDNEW
« no previous file with comments | « third_party/afl/src/alloc-inl.h ('k') | third_party/afl/src/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698