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 #18342: doc: Add fuzzing quickstart guides for libFuzzer and afl-fuzz
33dd764 doc: Add fuzzing quickstart guides for libFuzzer and afl-fuzz. Simplify instructions. (practicalswift)
Pull request description:
Add fuzzing quickstart guide to make it trivial to start fuzzing Bitcoin Core.
Fuzzing is fun and having more people contributing coverage-increasing inputs to https://github.com/bitcoin-core/qa-assets would be awesome :)
ACKs for top commit:
MarcoFalke:
ACK 33dd764
fanquake:
ACK 33dd764 - ran through the quick start and process message instructions. macOS users might see issues with afl-fuzz.
Tree-SHA512: f3ca972ce6ed0df8bb8177bdbb1e16d8a235941ffe4fa7b95ce9520b6454694ee26d2c545eac0b8b81856a77e26befda0922a9121a445dd936a0e9f9dd034160
# macOS users: If you have problem with this step then make sure to read "macOS hints for
13
+
# libFuzzer" on https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md#macos-hints-for-libfuzzer
14
+
$ make
15
+
$ src/test/fuzz/process_message
16
+
# abort fuzzing using ctrl-c
17
+
```
18
+
19
+
## Fuzzing harnesses, fuzzing output and fuzzing corpora
20
+
21
+
[`process_message`](https://github.com/bitcoin/bitcoin/blob/master/src/test/fuzz/process_message.cpp) is a fuzzing harness for the [`ProcessMessage(...)` function (`net_processing`)](https://github.com/bitcoin/bitcoin/blob/master/src/net_processing.cpp). The available fuzzing harnesses are found in [`src/test/fuzz/`](https://github.com/bitcoin/bitcoin/tree/master/src/test/fuzz).
22
+
23
+
The fuzzer will output `NEW` every time it has created a test input that covers new areas of the code under test. For more information on how to interpret the fuzzer output, see the [libFuzzer documentation](https://llvm.org/docs/LibFuzzer.html).
24
+
25
+
If you specify a corpus directory then any new coverage increasing inputs will be saved there:
If you find coverage increasing inputs when fuzzing you are highly encouraged to submit them for inclusion in the [`bitcoin-core/qa-assets`](https://github.com/bitcoin-core/qa-assets) repo.
85
+
86
+
Every single pull request submitted against the Bitcoin Core repo is automatically tested against all inputs in the [`bitcoin-core/qa-assets`](https://github.com/bitcoin-core/qa-assets) repo. Contributing new coverage increasing inputs is an easy way to help make Bitcoin Core more robust.
87
+
88
+
## macOS hints for libFuzzer
89
+
90
+
The default Clang/LLVM version supplied by Apple on macOS does not include
123
91
fuzzing libraries, so macOS users will need to install a full version, for
124
92
example using `brew install llvm`.
125
93
@@ -128,11 +96,40 @@ may need to run `./configure` with `--disable-asm` to avoid errors
128
96
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
97
for more information.
130
98
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.
99
+
You may also need to take care of giving the correct path for`clang` and
100
+
`clang++`, like `CC=/path/to/clang CXX=/path/to/clang++`if the non-systems
101
+
`clang` does not come first in your path.
134
102
135
103
Full configure that was tested on macOS Catalina with `brew` installed `llvm`:
Read the [libFuzzer documentation](https://llvm.org/docs/LibFuzzer.html) for more information. This [libFuzzer tutorial](https://github.com/google/fuzzing/blob/master/tutorial/libFuzzerTutorial.md) might also be of interest.
110
+
111
+
# Fuzzing Bitcoin Core using american fuzzy lop (`afl-fuzz`)
112
+
113
+
## Quickstart guide
114
+
115
+
To quickly get started fuzzing Bitcoin Core using [`afl-fuzz`](https://github.com/google/afl):
0 commit comments