You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #17942: doc: Improve fuzzing docs for macOS users
b6c3e84 doc: Improve fuzzing docs for macOS users (Fabian Jahr)
Pull request description:
Adds several helpful hints for macOS users trying to get fuzzers to run locally using AFL or libFuzzer. These are partly based on this comment bitcoin/bitcoin#17657 (comment) and discussions in the review club for #17860. See: https://bitcoincore.reviews/17860.html
Based on the doc in the current state I could not compile fuzzers for AFL or libFuzzer. Using these hints, I can
- compile and run fuzzers with AFL
- compile but **not** run fuzzers with libFuzzer
Fuzzers compiled with libFuzzers may be running but don't produce any output. Looking for others to test this to see if it is an issue with my local system. Especially interesting if you have been running libFuzzer fuzzers successfully on macOS before.
Edit: Closes #17914
ACKs for top commit:
MarcoFalke:
ACK b6c3e84
Sjors:
ACK b6c3e84
fanquake:
ACK b6c3e84 - I think this has been nitpicked enough, and importantly the commands look better now.
Tree-SHA512: fdbacbcf10e9353a4ac3d22edf88663e33185ad2f244b986ff74c513de05f9fa62c4d8b17985d2f9288834c124b352cf52280627b5ff095735b411b12482e2ec
A recent version of `clang`, the address/undefined sanitizers (ASan/UBSan) and libFuzzer is needed (all
81
-
found in the `compiler-rt` runtime libraries package).
99
+
A recent version of `clang`, the address/undefined sanitizers (ASan/UBSan) and
100
+
libFuzzer is needed (all found in the `compiler-rt` runtime libraries package).
82
101
83
102
To build all fuzz targets with libFuzzer, run
84
103
@@ -87,11 +106,33 @@ To build all fuzz targets with libFuzzer, run
87
106
make
88
107
```
89
108
90
-
The fuzzer needs some inputs to work on, but the inputs or seeds can be used
91
-
interchangeably between libFuzzer and AFL.
92
-
93
109
See https://llvm.org/docs/LibFuzzer.html#running on how to run the libFuzzer
94
110
instrumented executable.
95
111
96
-
Alternatively run the script in `./test/fuzz/test_runner.py` and provide it
97
-
with the `${DIR_FUZZ_IN}` created earlier.
112
+
Alternatively, you can run the script through the fuzzing test harness (only
113
+
libFuzzer supported so far). You need to pass it the inputs directory and
114
+
the specific test target you want to run.
115
+
116
+
```
117
+
./test/fuzz/test_runner.py ${DIR_FUZZ_IN} bech32
118
+
```
119
+
120
+
### macOS hints for libFuzzer
121
+
122
+
The default clang/llvm version supplied by Apple on macOS does not include
123
+
fuzzing libraries, so macOS users will need to install a full version, for
124
+
example using `brew install llvm`.
125
+
126
+
Should you run into problems with the address sanitizer, it is possible you
127
+
may need to run `./configure` with `--disable-asm` to avoid errors
128
+
with certain assembly code from Bitcoin Core's code. See [developer notes on sanitizers](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#sanitizers)
129
+
for more information.
130
+
131
+
You may also need to take care of giving the correct path for clang and
132
+
clang++, like `CC=/path/to/clang CXX=/path/to/clang++` if the non-systems
133
+
clang does not come first in your path.
134
+
135
+
Full configure that was tested on macOS Catalina with `brew` installed `llvm`:
0 commit comments