github.com/decred/dcrlnd@v0.7.6/docs/fuzz.md (about) 1 # Fuzzing LND # 2 3 The `fuzz` package is organized into subpackages which are named after the `lnd` package they test. Each subpackage has its own set of fuzz targets. 4 5 ## Setup and Installation ## 6 This section will cover setup and installation of the fuzzing binaries. 7 8 * The following is a command to build all fuzzing harnesses: 9 ```shell 10 ⛰ make fuzz-build 11 ``` 12 13 * This may take a while since this will create zip files associated with each fuzzing target. 14 15 * The following is a command to run all fuzzing harnesses for 30 seconds: 16 ```shell 17 ⛰ make fuzz-run 18 ``` 19 20 `go-fuzz` will print out log lines every couple of seconds. Example output: 21 ```text 22 2017/09/19 17:44:23 workers: 8, corpus: 23 (3s ago), crashers: 1, restarts: 1/748, execs: 400690 (16694/sec), cover: 394, uptime: 24s 23 ``` 24 Corpus is the number of items in the corpus. `go-fuzz` may add valid inputs to 25 the corpus in an attempt to gain more coverage. Crashers is the number of inputs 26 resulting in a crash. The inputs, and their outputs are logged by default in: 27 `fuzz/<package>/<harness>/crashers`. `go-fuzz` also creates a `suppressions` directory 28 of stacktraces to ignore so that it doesn't create duplicate stacktraces. 29 Cover is a number representing edge coverage of the program being fuzzed. 30 31 ## Options ## 32 Several parameters can be appended to the end of the make commands to tune the build process or the way the fuzzer runs. 33 - `run_time` specifies how long each fuzz harness runs for. The default is 30 seconds. 34 - `timeout` specifies how long an individual testcase can run before raising an error. The default is 20 seconds. 35 - `processes` specifies the number of parallel processes to use while running the harnesses. 36 - `pkg` specifies the `lnd` packages to build or fuzz. The default is to build and run all available packages (`brontide lnwire wtwire zpay32`). This can be changed to build/run against individual packages. 37 - `base_workdir` specifies the workspace of the fuzzer. This folder will contain the corpus, crashers, and suppressions. 38 39 ## Corpus ## 40 Fuzzing generally works best with a corpus that is of minimal size while achieving the maximum coverage. `go-fuzz` automatically minimizes the corpus in-memory before fuzzing so a large corpus shouldn't make a difference. 41 42 ## Disclosure ## 43 If you find any crashers that affect LND security, please disclose with the information found [here](https://github.com/lightningnetwork/lnd/#security).