| OLD | NEW |
| 1 ======================= | 1 ======================= |
| 2 Environmental variables | 2 Environmental variables |
| 3 ======================= | 3 ======================= |
| 4 | 4 |
| 5 This document discusses the environment variables used by American Fuzzy Lop | 5 This document discusses the environment variables used by American Fuzzy Lop |
| 6 to expose various exotic functions that may be (rarely) useful for power | 6 to expose various exotic functions that may be (rarely) useful for power |
| 7 users or for some types of custom fuzzing setups. See README for the general | 7 users or for some types of custom fuzzing setups. See README for the general |
| 8 instruction manual. | 8 instruction manual. |
| 9 | 9 |
| 10 1) Settings for afl-gcc, afl-clang, and afl-as | 10 1) Settings for afl-gcc, afl-clang, and afl-as |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 probability of instrumenting every branch. This is (very rarely) useful | 45 probability of instrumenting every branch. This is (very rarely) useful |
| 46 when dealing with exceptionally complex programs that saturate the output | 46 when dealing with exceptionally complex programs that saturate the output |
| 47 bitmap. Examples include v8, ffmpeg, and perl. | 47 bitmap. Examples include v8, ffmpeg, and perl. |
| 48 | 48 |
| 49 (If this ever happens, afl-fuzz will warn you ahead of the time by | 49 (If this ever happens, afl-fuzz will warn you ahead of the time by |
| 50 displaying the "bitmap density" field in fiery red.) | 50 displaying the "bitmap density" field in fiery red.) |
| 51 | 51 |
| 52 Setting AFL_INST_RATIO to 0 is a valid choice. This will instrument only | 52 Setting AFL_INST_RATIO to 0 is a valid choice. This will instrument only |
| 53 the transitions between function entry points, but not individual branches. | 53 the transitions between function entry points, but not individual branches. |
| 54 | 54 |
| 55 - AFL_NO_BUILTIN causes the compiler to generate code suitable for use with |
| 56 libtokencap.so (but perhaps running a bit slower than without the flag). |
| 57 |
| 55 - TMPDIR is used by afl-as for temporary files; if this variable is not set, | 58 - TMPDIR is used by afl-as for temporary files; if this variable is not set, |
| 56 the tool defaults to /tmp. | 59 the tool defaults to /tmp. |
| 57 | 60 |
| 58 - Setting AFL_KEEP_ASSEMBLY prevents afl-as from deleting instrumented | 61 - Setting AFL_KEEP_ASSEMBLY prevents afl-as from deleting instrumented |
| 59 assembly files. Useful for troubleshooting problems or understanding how | 62 assembly files. Useful for troubleshooting problems or understanding how |
| 60 the tool works. To get them in a predictable place, try something like: | 63 the tool works. To get them in a predictable place, try something like: |
| 61 | 64 |
| 62 mkdir assembly_here | 65 mkdir assembly_here |
| 63 TMPDIR=$PWD/assembly_here AFL_KEEP_ASSEMBLY=1 make clean all | 66 TMPDIR=$PWD/assembly_here AFL_KEEP_ASSEMBLY=1 make clean all |
| 64 | 67 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 92 | 95 |
| 93 - Setting AFL_NO_FORKSRV disables the forkserver optimization, reverting to | 96 - Setting AFL_NO_FORKSRV disables the forkserver optimization, reverting to |
| 94 fork + execve() call for every tested input. This is useful mostly when | 97 fork + execve() call for every tested input. This is useful mostly when |
| 95 working with unruly libraries that create threads or do other crazy | 98 working with unruly libraries that create threads or do other crazy |
| 96 things when initializing (before the instrumentation has a chance to run). | 99 things when initializing (before the instrumentation has a chance to run). |
| 97 | 100 |
| 98 Note that this setting inhibits some of the user-friendly diagnostics | 101 Note that this setting inhibits some of the user-friendly diagnostics |
| 99 normally done when starting up the forkserver and causes a pretty | 102 normally done when starting up the forkserver and causes a pretty |
| 100 significant performance drop. | 103 significant performance drop. |
| 101 | 104 |
| 102 - Setting AFL_NO_VAR_CHECK skips the detection of variable test cases, | |
| 103 greatly speeding up session resumption and path discovery for complex | |
| 104 multi-threaded apps (but depriving you of a potentially useful signal | |
| 105 in more orderly programs). | |
| 106 | |
| 107 - AFL_EXIT_WHEN_DONE causes afl-fuzz to terminate when all existing paths | 105 - AFL_EXIT_WHEN_DONE causes afl-fuzz to terminate when all existing paths |
| 108 have been fuzzed and there were no new finds for a while. This would be | 106 have been fuzzed and there were no new finds for a while. This would be |
| 109 normally indicated by the cycle counter in the UI turning green. May be | 107 normally indicated by the cycle counter in the UI turning green. May be |
| 110 convenient for some types of automated jobs. | 108 convenient for some types of automated jobs. |
| 111 | 109 |
| 110 - Setting AFL_NO_AFFINITY disables attempts to bind to a specific CPU core |
| 111 on Linux systems. This slows things down, but lets you run more instances |
| 112 of afl-fuzz than would be prudent (if you really want to). |
| 113 |
| 112 - AFL_SKIP_CRASHES causes AFL to tolerate crashing files in the input | 114 - AFL_SKIP_CRASHES causes AFL to tolerate crashing files in the input |
| 113 queue. This can help with rare situations where a program crashes only | 115 queue. This can help with rare situations where a program crashes only |
| 114 intermittently, but it's not really recommended under normal operating | 116 intermittently, but it's not really recommended under normal operating |
| 115 conditions. | 117 conditions. |
| 116 | 118 |
| 117 - AFL_SHUFFLE_QUEUE randomly reorders the input queue on startup. Requested | 119 - AFL_SHUFFLE_QUEUE randomly reorders the input queue on startup. Requested |
| 118 by some users for unorthodox parallelized fuzzing setups, but not | 120 by some users for unorthodox parallelized fuzzing setups, but not |
| 119 advisable otherwise. | 121 advisable otherwise. |
| 120 | 122 |
| 121 - When developing custom instrumentation on top of afl-fuzz, you can use | 123 - When developing custom instrumentation on top of afl-fuzz, you can use |
| (...skipping 10 matching lines...) Expand all Loading... |
| 132 - Setting AFL_POST_LIBRARY allows you to configure a postprocessor for | 134 - Setting AFL_POST_LIBRARY allows you to configure a postprocessor for |
| 133 mutated files - say, to fix up checksums. See experimental/post_library/ | 135 mutated files - say, to fix up checksums. See experimental/post_library/ |
| 134 for more. | 136 for more. |
| 135 | 137 |
| 136 - The CPU widget shown at the bottom of the screen is fairly simplistic and | 138 - The CPU widget shown at the bottom of the screen is fairly simplistic and |
| 137 may complain of high load prematurely, especially on systems with low core | 139 may complain of high load prematurely, especially on systems with low core |
| 138 counts. To avoid the alarming red color, you can set AFL_NO_CPU_RED. | 140 counts. To avoid the alarming red color, you can set AFL_NO_CPU_RED. |
| 139 | 141 |
| 140 - In QEMU mode (-Q), AFL_PATH will be searched for afl-qemu-trace. | 142 - In QEMU mode (-Q), AFL_PATH will be searched for afl-qemu-trace. |
| 141 | 143 |
| 142 - Setting AFL_LD_PRELOAD causes AFL to set LD_PRELOAD for the target binary | 144 - Setting AFL_PRELOAD causes AFL to set LD_PRELOAD for the target binary |
| 143 without disrupting the afl-fuzz process itself. | 145 without disrupting the afl-fuzz process itself. This is useful, among other |
| 146 things, for bootstrapping libdislocator.so. |
| 144 | 147 |
| 145 - If you are Jakub, you may need AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES. | 148 - If you are Jakub, you may need AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES. |
| 146 Others need not apply. | 149 Others need not apply. |
| 147 | 150 |
| 148 - Benchmarking only: AFL_BENCH_JUST_ONE causes the fuzzer to exit after | 151 - Benchmarking only: AFL_BENCH_JUST_ONE causes the fuzzer to exit after |
| 149 processing the first queue entry; and AFL_BENCH_UNTIL_CRASH causes it to | 152 processing the first queue entry; and AFL_BENCH_UNTIL_CRASH causes it to |
| 150 exit when first crash is found. | 153 exit soon after the first crash is found. |
| 151 | 154 |
| 152 4) Settings for afl-qemu-trace | 155 4) Settings for afl-qemu-trace |
| 153 ------------------------------ | 156 ------------------------------ |
| 154 | 157 |
| 155 The QEMU wrapper used to instrument binary-only code supports several settings: | 158 The QEMU wrapper used to instrument binary-only code supports several settings: |
| 156 | 159 |
| 157 - It is possible to set AFL_INST_RATIO to skip the instrumentation on some | 160 - It is possible to set AFL_INST_RATIO to skip the instrumentation on some |
| 158 of the basic blocks, which can be useful when dealing with very complex | 161 of the basic blocks, which can be useful when dealing with very complex |
| 159 binaries. | 162 binaries. |
| 160 | 163 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 177 minimization and normally deleted at exit. The files can be found in the | 180 minimization and normally deleted at exit. The files can be found in the |
| 178 <out_dir>/.traces/*. | 181 <out_dir>/.traces/*. |
| 179 | 182 |
| 180 6) Settings for afl-tmin | 183 6) Settings for afl-tmin |
| 181 ------------------------ | 184 ------------------------ |
| 182 | 185 |
| 183 Virtually nothing to play with. Well, in QEMU mode (-Q), AFL_PATH will be | 186 Virtually nothing to play with. Well, in QEMU mode (-Q), AFL_PATH will be |
| 184 searched for afl-qemu-trace. In addition to this, TMPDIR may be used if a | 187 searched for afl-qemu-trace. In addition to this, TMPDIR may be used if a |
| 185 temporary file can't be created in the current working directory. | 188 temporary file can't be created in the current working directory. |
| 186 | 189 |
| 187 7) Third-party variables set by afl-fuzz & other tools | 190 7) Settings for libdislocator.so |
| 191 -------------------------------- |
| 192 |
| 193 The library honors three environmental variables: |
| 194 |
| 195 - AFL_LD_LIMIT_MB caps the size of the maximum heap usage permitted by the |
| 196 library, in megabytes. The default value is 1 GB. Once this is exceeded, |
| 197 allocations will return NULL. |
| 198 |
| 199 - AFL_LD_HARD_FAIL alters the behavior by calling abort() on excessive |
| 200 allocations, thus causing what AFL would perceive as a crash. Useful for |
| 201 programs that are supposed to maintain a specific memory footprint. |
| 202 |
| 203 - AFL_LD_VERBOSE causes the library to output some diagnostic messages |
| 204 that may be useful for pinpointing the cause of any observed issues. |
| 205 |
| 206 8) Settings for libtokencap.so |
| 207 ------------------------------ |
| 208 |
| 209 This library accepts AFL_TOKEN_FILE to indicate the location to which the |
| 210 discovered tokens should be written. |
| 211 |
| 212 9) Third-party variables set by afl-fuzz & other tools |
| 188 ------------------------------------------------------ | 213 ------------------------------------------------------ |
| 189 | 214 |
| 190 Several variables are not directly interpreted by afl-fuzz, but are set to | 215 Several variables are not directly interpreted by afl-fuzz, but are set to |
| 191 optimal values if not already present in the environment: | 216 optimal values if not already present in the environment: |
| 192 | 217 |
| 193 - By default, LD_BIND_NOW is set to speed up fuzzing by forcing the | 218 - By default, LD_BIND_NOW is set to speed up fuzzing by forcing the |
| 194 linker to do all the work before the fork server kicks in. You can | 219 linker to do all the work before the fork server kicks in. You can |
| 195 override this by setting LD_BIND_LAZY beforehand, but it is almost | 220 override this by setting LD_BIND_LAZY beforehand, but it is almost |
| 196 certainly pointless. | 221 certainly pointless. |
| 197 | 222 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 208 difficulty telling crashes and hangs apart. | 233 difficulty telling crashes and hangs apart. |
| 209 | 234 |
| 210 - In the same vein, by default, MSAN_OPTIONS are set to: | 235 - In the same vein, by default, MSAN_OPTIONS are set to: |
| 211 | 236 |
| 212 exit_code=86 (required for legacy reasons) | 237 exit_code=86 (required for legacy reasons) |
| 213 abort_on_error=1 | 238 abort_on_error=1 |
| 214 symbolize=0 | 239 symbolize=0 |
| 215 msan_track_origins=0 | 240 msan_track_origins=0 |
| 216 allocator_may_return_null=1 | 241 allocator_may_return_null=1 |
| 217 | 242 |
| 218 Be sure to include the first one when customizing anything, since MSAN | 243 Be sure to include the first one when customizing anything, since some |
| 219 doesn't call abort() on error, and we need a way to detect faults. | 244 MSAN versions don't call abort() on error, and we need a way to detect |
| 245 faults. |
| OLD | NEW |