| OLD | NEW |
| 1 ================================= | 1 ================================= |
| 2 Tips for performance optimization | 2 Tips for performance optimization |
| 3 ================================= | 3 ================================= |
| 4 | 4 |
| 5 This file provides tips for troubleshooting slow or wasteful fuzzing jobs. | 5 This file provides tips for troubleshooting slow or wasteful fuzzing jobs. |
| 6 See README for the general instruction manual. | 6 See README for the general instruction manual. |
| 7 | 7 |
| 8 1) Keep your test cases small | 8 1) Keep your test cases small |
| 9 ----------------------------- | 9 ----------------------------- |
| 10 | 10 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 For programs that are nominally very fast, but get sluggish for some inputs, | 137 For programs that are nominally very fast, but get sluggish for some inputs, |
| 138 you can also try setting -t values that are more punishing than what afl-fuzz | 138 you can also try setting -t values that are more punishing than what afl-fuzz |
| 139 dares to use on its own. On fast and idle machines, going down to -t 5 may be | 139 dares to use on its own. On fast and idle machines, going down to -t 5 may be |
| 140 a viable plan. | 140 a viable plan. |
| 141 | 141 |
| 142 The -m parameter is worth looking at, too. Some programs can end up spending | 142 The -m parameter is worth looking at, too. Some programs can end up spending |
| 143 a fair amount of time allocating and initializing megabytes of memory when | 143 a fair amount of time allocating and initializing megabytes of memory when |
| 144 presented with pathological inputs. Low -m values can make them give up sooner | 144 presented with pathological inputs. Low -m values can make them give up sooner |
| 145 and not waste CPU time. | 145 and not waste CPU time. |
| 146 | 146 |
| 147 8) Set CPU core affinity for AFL | 147 8) Check OS configuration |
| 148 -------------------------------- | |
| 149 | |
| 150 Making sure that the fuzzer always runs on the same (idle) CPU core can offer | |
| 151 a significant speed bump and reduce scheduler jitter. The benefits can be even | |
| 152 more striking on true multiprocessor systems. | |
| 153 | |
| 154 On Linux, you can assign the fuzzer to a specific core by first running | |
| 155 afl-gotcpu to see which cores are idle, and then specifying the ID of a | |
| 156 preferred core via -Z, like so: | |
| 157 | |
| 158 $ ./afl-fuzz -Z core_id [...other parameters...] | |
| 159 | |
| 160 Note that this parameter needs to be used with care; accidentally forcing | |
| 161 multiple fuzzers to share the same core may result in performance that is | |
| 162 worse than what you would get without -Z. | |
| 163 | |
| 164 (It is also possible to specify two comma-delimited values for -Z, in which | |
| 165 case, the fuzzer will run on one designated core, and the target binary will | |
| 166 be banished to another. This can sometimes offer minor benefits, but isn't | |
| 167 recommended for general use.) | |
| 168 | |
| 169 9) Check OS configuration | |
| 170 ------------------------- | 148 ------------------------- |
| 171 | 149 |
| 172 There are several OS-level factors that may affect fuzzing speed: | 150 There are several OS-level factors that may affect fuzzing speed: |
| 173 | 151 |
| 174 - High system load. Use idle machines where possible. Kill any non-essential | 152 - High system load. Use idle machines where possible. Kill any non-essential |
| 175 CPU hogs (idle browser windows, media players, complex screensavers, etc). | 153 CPU hogs (idle browser windows, media players, complex screensavers, etc). |
| 176 | 154 |
| 177 - Network filesystems, either used for fuzzer input / output, or accessed by | 155 - Network filesystems, either used for fuzzer input / output, or accessed by |
| 178 the fuzzed binary to read configuration files (pay special attention to the | 156 the fuzzed binary to read configuration files (pay special attention to the |
| 179 home directory - many programs search it for dot-files). | 157 home directory - many programs search it for dot-files). |
| (...skipping 13 matching lines...) Expand all Loading... |
| 193 one target to another, but on Linux, you may want to make sure that the | 171 one target to another, but on Linux, you may want to make sure that the |
| 194 following options are set: | 172 following options are set: |
| 195 | 173 |
| 196 echo 1 >/proc/sys/kernel/sched_child_runs_first | 174 echo 1 >/proc/sys/kernel/sched_child_runs_first |
| 197 echo 1 >/proc/sys/kernel/sched_autogroup_enabled | 175 echo 1 >/proc/sys/kernel/sched_autogroup_enabled |
| 198 | 176 |
| 199 Setting a different scheduling policy for the fuzzer process - say | 177 Setting a different scheduling policy for the fuzzer process - say |
| 200 SCHED_RR - can usually speed things up, too, but needs to be done with | 178 SCHED_RR - can usually speed things up, too, but needs to be done with |
| 201 care. | 179 care. |
| 202 | 180 |
| 203 10) If all other options fail, use -d | 181 9) If all other options fail, use -d |
| 204 ------------------------------------- | 182 ------------------------------------ |
| 205 | 183 |
| 206 For programs that are genuinely slow, in cases where you really can't escape | 184 For programs that are genuinely slow, in cases where you really can't escape |
| 207 using huge input files, or when you simply want to get quick and dirty results | 185 using huge input files, or when you simply want to get quick and dirty results |
| 208 early on, you can always resort to the -d mode. | 186 early on, you can always resort to the -d mode. |
| 209 | 187 |
| 210 The mode causes afl-fuzz to skip all the deterministic fuzzing steps, which | 188 The mode causes afl-fuzz to skip all the deterministic fuzzing steps, which |
| 211 makes output a lot less neat and makes the testing a bit less in-depth, but | 189 makes output a lot less neat and makes the testing a bit less in-depth, but |
| 212 it will give you an experience more familiar from other fuzzing tools. | 190 it will give you an experience more familiar from other fuzzing tools. |
| OLD | NEW |