1
- =========================
2
- Tips for parallel fuzzing
3
- =========================
1
+ # Tips for parallel fuzzing
4
2
5
3
This document talks about synchronizing afl-fuzz jobs on a single machine
6
4
or across a fleet of systems. See README for the general instruction manual.
7
5
8
- 1) Introduction
9
- ---------------
6
+ ## 1) Introduction
10
7
11
8
Every copy of afl-fuzz will take up one CPU core. This means that on an
12
9
n-core system, you can almost always run around n concurrent fuzzing jobs with
@@ -33,8 +30,7 @@ several instances in parallel. See docs/power_schedules.txt
33
30
Alternatively running other AFL spinoffs in parallel can be of value,
34
31
e.g. Angora (https://github.com/AngoraFuzzer/Angora/ )
35
32
36
- 2) Single-system parallelization
37
- --------------------------------
33
+ ## 2) Single-system parallelization
38
34
39
35
If you wish to parallelize a single job across multiple cores on a local
40
36
system, simply create a new, empty output directory ("sync dir") that will be
@@ -43,12 +39,16 @@ for every instance - say, "fuzzer01", "fuzzer02", etc.
43
39
44
40
Run the first one ("master", -M) like this:
45
41
42
+ ```
46
43
$ ./afl-fuzz -i testcase_dir -o sync_dir -M fuzzer01 [...other stuff...]
44
+ ```
47
45
48
46
...and then, start up secondary (-S) instances like this:
49
47
48
+ ```
50
49
$ ./afl-fuzz -i testcase_dir -o sync_dir -S fuzzer02 [...other stuff...]
51
50
$ ./afl-fuzz -i testcase_dir -o sync_dir -S fuzzer03 [...other stuff...]
51
+ ```
52
52
53
53
Each fuzzer will keep its state in a separate subdirectory, like so:
54
54
@@ -68,9 +68,11 @@ Note that running multiple -M instances is wasteful, although there is an
68
68
experimental support for parallelizing the deterministic checks. To leverage
69
69
that, you need to create -M instances like so:
70
70
71
+ ```
71
72
$ ./afl-fuzz -i testcase_dir -o sync_dir -M masterA:1/3 [...]
72
73
$ ./afl-fuzz -i testcase_dir -o sync_dir -M masterB:2/3 [...]
73
74
$ ./afl-fuzz -i testcase_dir -o sync_dir -M masterC:3/3 [...]
75
+ ```
74
76
75
77
...where the first value after ':' is the sequential ID of a particular master
76
78
instance (starting at 1), and the second value is the total number of fuzzers to
@@ -86,15 +88,16 @@ WARNING: Exercise caution when explicitly specifying the -f option. Each fuzzer
86
88
must use a separate temporary file; otherwise, things will go south. One safe
87
89
example may be:
88
90
91
+ ```
89
92
$ ./afl-fuzz [...] -S fuzzer10 -f file10.txt ./fuzzed/binary @@
90
93
$ ./afl-fuzz [...] -S fuzzer11 -f file11.txt ./fuzzed/binary @@
91
94
$ ./afl-fuzz [...] -S fuzzer12 -f file12.txt ./fuzzed/binary @@
95
+ ```
92
96
93
97
This is not a concern if you use @@ without -f and let afl-fuzz come up with the
94
98
file name.
95
99
96
- 3) Multi-system parallelization
97
- -------------------------------
100
+ ## 3) Multi-system parallelization
98
101
99
102
The basic operating principle for multi-system parallelization is similar to
100
103
the mechanism explained in section 2. The key difference is that you need to
@@ -106,18 +109,22 @@ write a simple script that performs two actions:
106
109
that includes host name in the fuzzer ID, so that you can do something
107
110
like:
108
111
112
+ ``` sh
109
113
for s in {1..10}; do
110
114
ssh user@host${s} " tar -czf - sync/host${s} _fuzzid*/[qf]*" > host${s} .tgz
111
115
done
116
+ ```
112
117
113
118
- Distributes and unpacks these files on all the remaining machines, e.g.:
114
119
120
+ ` ` ` sh
115
121
for s in {1..10}; do
116
122
for d in {1..10}; do
117
123
test " $s " = " $d " && continue
118
124
ssh user@host${d} ' tar -kxzf -' < host${s} .tgz
119
125
done
120
126
done
127
+ ` ` `
121
128
122
129
There is an example of such a script in experimental/distributed_fuzzing/;
123
130
you can also find a more featured, experimental tool developed by
@@ -167,8 +174,7 @@ It is *not* advisable to skip the synchronization script and run the fuzzers
167
174
directly on a network filesystem; unexpected latency and unkillable processes
168
175
in I/O wait state can mess things up.
169
176
170
- 4) Remote monitoring and data collection
171
- ----------------------------------------
177
+ # # 4) Remote monitoring and data collection
172
178
173
179
You can use screen, nohup, tmux, or something equivalent to run remote
174
180
instances of afl-fuzz. If you redirect the program' s output to a file, it will
@@ -192,8 +198,7 @@ Keep in mind that crashing inputs are *not* automatically propagated to the
192
198
master instance, so you may still want to monitor for crashes fleet-wide
193
199
from within your synchronization or health checking scripts (see afl-whatsup).
194
200
195
- 5) Asymmetric setups
196
- --------------------
201
+ # # 5) Asymmetric setups
197
202
198
203
It is perhaps worth noting that all of the following is permitted:
199
204
0 commit comments