Merge #21398: doc: Update fuzzing docs for afl-clang-lto

fab633d2dbfed1efcc3a02061685d56327ae51fd doc: Update fuzzing docs for afl-clang-lto (MarcoFalke)

Pull request description:

  Update the docs to default to `afl-clang-lto`. The afl-gcc (and other afl legacy fuzz engines) are still supported, though discouraged.

ACKs for top commit:
  fanquake:
    ACK fab633d2dbfed1efcc3a02061685d56327ae51fd - seems to work for me. Compiled and ran some fuzzers using Clang 11 on Bionic. Set `llvm-config` so that `clang-11` would be used over `clang` (10).
  jarolrod:
    ACK fab633d2dbfed1efcc3a02061685d56327ae51fd, tested on Ubuntu Focal

Tree-SHA512: 3d1969c167bea45a9d691f3b757f51213d550c9c1b895bed1fcf3c2f7345791787cfb13c376291b94eb3181caf4ae3126f4d01c7cebda7b2bb1c40a1294e9a68
This commit is contained in:
MarcoFalke 2021-03-15 18:52:55 +01:00 committed by PastaPastaPasta
parent 7a2d07c683
commit aebc28725b

View File

@ -128,33 +128,32 @@ 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. 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.
# Fuzzing Dash Core using american fuzzy lop (`afl-fuzz`) # Fuzzing Dash Core using afl++
## Quickstart guide ## Quickstart guide
To quickly get started fuzzing Dash Core using [`afl-fuzz`](https://github.com/google/afl): To quickly get started fuzzing Dash Core using [afl++](https://github.com/AFLplusplus/AFLplusplus):
```sh ```sh
$ git clone https://github.com/dashpay/dash $ git clone https://github.com/dashpay/dash
$ cd dash/ $ cd dash/
$ git clone https://github.com/google/afl $ git clone https://github.com/AFLplusplus/AFLplusplus
$ make -C afl/ $ make -C AFLplusplus/ source-only
$ make -C afl/llvm_mode/
$ ./autogen.sh $ ./autogen.sh
# It is possible to compile with afl-gcc and afl-g++ instead of afl-clang. However, running afl-fuzz # If afl-clang-lto is not available, see
# may require more memory via the -m flag. # https://github.com/AFLplusplus/AFLplusplus#a-selecting-the-best-afl-compiler-for-instrumenting-the-target
$ CC=$(pwd)/afl/afl-clang-fast CXX=$(pwd)/afl/afl-clang-fast++ ./configure --enable-fuzz --enable-c++17 $ CC=$(pwd)/AFLplusplus/afl-clang-lto CXX=$(pwd)/AFLplusplus/afl-clang-lto++ ./configure --enable-fuzz --enable-c++17
$ make $ make
# For macOS you may need to ignore x86 compilation checks when running "make". If so, # For macOS you may need to ignore x86 compilation checks when running "make". If so,
# try compiling using: AFL_NO_X86=1 make # try compiling using: AFL_NO_X86=1 make
$ mkdir -p inputs/ outputs/ $ mkdir -p inputs/ outputs/
$ echo A > inputs/thin-air-input $ echo A > inputs/thin-air-input
$ FUZZ=bech32 afl/afl-fuzz -i inputs/ -o outputs/ -- src/test/fuzz/fuzz $ FUZZ=bech32 AFLplusplus/afl-fuzz -i inputs/ -o outputs/ -- src/test/fuzz/fuzz
# You may have to change a few kernel parameters to test optimally - afl-fuzz # You may have to change a few kernel parameters to test optimally - afl-fuzz
# will print an error and suggestion if so. # will print an error and suggestion if so.
``` ```
Read the [`afl-fuzz` documentation](https://github.com/google/afl) for more information. Read the [afl++ documentation](https://github.com/AFLplusplus/AFLplusplus) for more information.
# Fuzzing Dash Core using Honggfuzz # Fuzzing Dash Core using Honggfuzz