mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 16:14:23 +01:00
doc: add section about improving fuzzing corpora
We want to encourage contributions to the seed corpora that improve coverage.
This commit is contained in:
committed by
Rusty Russell
parent
6e11a2e416
commit
ca80dee514
@@ -60,7 +60,43 @@ The latter will run all targets two by two `12345` times.
|
|||||||
If you want to contribute new seeds, be sure to merge your corpus with the main one:
|
If you want to contribute new seeds, be sure to merge your corpus with the main one:
|
||||||
```
|
```
|
||||||
./tests/fuzz/run.py my_locally_extended_fuzz_corpus -j2 --generate --runs 12345
|
./tests/fuzz/run.py my_locally_extended_fuzz_corpus -j2 --generate --runs 12345
|
||||||
./tests/fuzz/run.py main_fuzz_corpus --merge_dir my_locally_extended_fuzz_corpus
|
./tests/fuzz/run.py tests/fuzz/corpora --merge_dir my_locally_extended_fuzz_corpus
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Improve seed corpora
|
||||||
|
|
||||||
|
If you find coverage increasing inputs while fuzzing, please create a pull
|
||||||
|
request to add them into `tests/fuzz/corpora`. Be sure to minimize any additions
|
||||||
|
to the corpora first.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
Here's an example workflow to contribute new inputs for the `fuzz-addr` target.
|
||||||
|
|
||||||
|
Create a directory for newly found corpus inputs and begin fuzzing:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mkdir -p local_corpora/fuzz-addr
|
||||||
|
./tests/fuzz/fuzz-addr -jobs=4 local_corpora/fuzz-addr tests/fuzz/corpora/fuzz-addr/
|
||||||
|
```
|
||||||
|
|
||||||
|
After some time, libFuzzer may find some potential coverage increasing inputs
|
||||||
|
and save them in `local_corpora/fuzz-addr`. We can then merge them into the seed
|
||||||
|
corpora in `tests/fuzz/corpora`:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
./tests/fuzz/run.py tests/fuzz/corpora --merge_dir local_corpora
|
||||||
|
```
|
||||||
|
|
||||||
|
This will copy over any inputs that improve the coverage of the existing corpus.
|
||||||
|
If any new inputs were added, create a pull request to improve the upstream seed
|
||||||
|
corpus:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git add tests/fuzz/corpora/fuzz-addr/*
|
||||||
|
git commit
|
||||||
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user