Add support for fuzzing with AFL Reviewed-by: Ben Laurie <ben@links.org> MR: #2740
diff --git a/fuzz/README.md b/fuzz/README.md index 9b6d7d7..e9ec88b 100644 --- a/fuzz/README.md +++ b/fuzz/README.md
@@ -1,5 +1,8 @@ # I Can Haz Fuzz? +LibFuzzer +========= + Or, how to fuzz OpenSSL with [libfuzzer](llvm.org/docs/LibFuzzer.html). Starting from a vanilla+OpenSSH server Ubuntu install. @@ -32,7 +35,10 @@ Configure for fuzzing: - $ CC=clang ./config enable-fuzz enable-asan enable-ubsan no-shared + $ CC=clang ./config enable-fuzz-libfuzzer \ + --with-fuzzer-include=../../svn-work/Fuzzer \ + --with-fuzzer-lib=../../svn-work/Fuzzer/libFuzzer \ + enable-asan enable-ubsan no-shared $ sudo apt-get install make $ LDCMD=clang++ make -j $ fuzz/helper.py <fuzzer> <arguments> @@ -45,3 +51,20 @@ `fuzz/corpora/<fuzzer>-crash/`. You can reproduce the crash with $ fuzz/<fuzzer> <crashfile> + +AFL +=== + +Configure for fuzzing: + + $ sudo apt-get install afl-clang + $ CC=afl-clang-fast ./config enable-fuzz-afl no-shared + $ make + +Run one of the fuzzers: + + $ afl-fuzz fuzz/<fuzzer> -i fuzz/corpora/<fuzzer> -o fuzz/corpora/<fuzzer>/out <fuzzer> <arguments> + +Where `<fuzzer>` is one of the executables in `fuzz/`. Most fuzzers do not +need any command line arguments, but, for example, `asn1` needs the name of a +data type.