Skip to content

Commit d8f1ea7

Browse files
committed
doc: describe in fuzzing.md how to reproduce a CI crash
and add/improve a few headers
1 parent 7041d25 commit d8f1ea7

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

doc/fuzzing.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $ FUZZ=process_message src/test/fuzz/fuzz
1616
# abort fuzzing using ctrl-c
1717
```
1818

19-
## Fuzzing harnesses, fuzzing output and fuzzing corpora
19+
## Fuzzing harnesses and output
2020

2121
[`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).
2222

@@ -64,6 +64,8 @@ block^@M-^?M-^?M-^?M-^?M-^?nM-^?M-^?
6464
6565
In this case the fuzzer managed to create a `block` message which when passed to `ProcessMessage(...)` increased coverage.
6666
67+
## Fuzzing corpora
68+
6769
The project's collection of seed corpora is found in the [`bitcoin-core/qa-assets`](https://github.com/bitcoin-core/qa-assets) repo.
6870
6971
To fuzz `process_message` using the [`bitcoin-core/qa-assets`](https://github.com/bitcoin-core/qa-assets) seed corpus:
@@ -81,6 +83,20 @@ INFO: seed corpus: files: 991 min: 1b max: 1858b total: 288291b rss: 150Mb
8183
8284
```
8385
86+
## Reproduce a fuzzer crash reported by the CI
87+
88+
- `cd` into the `qa-assets` directory and update it with `git pull qa-assets`
89+
- locate the crash case described in the CI output, e.g. `Test unit written to
90+
./crash-1bc91feec9fc00b107d97dc225a9f2cdaa078eb6`
91+
- make sure to compile with all sanitizers, if they are needed (fuzzing runs
92+
more slowly with sanitizers enabled, but a crash should be reproducible very
93+
quickly from a crash case)
94+
- run the fuzzer with the case number appended to the seed corpus path:
95+
`FUZZ=process_message src/test/fuzz/fuzz
96+
qa-assets/fuzz_seed_corpus/process_message/1bc91feec9fc00b107d97dc225a9f2cdaa078eb6`
97+
98+
## Submit improved coverage
99+
84100
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.
85101
86102
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.

0 commit comments

Comments
 (0)