3 See also https://wiki.samba.org/index.php/Fuzzing
5 Fuzzing supplies valid, invalid, unexpected or random data as input to a piece
6 of code. Instrumentation, usually compiler-implemented, is used to monitor for
7 exceptions such as crashes, assertions or memory corruption.
9 See [Wikipedia article on fuzzing](https://en.wikipedia.org/wiki/Fuzzing) for
14 ## Configure with fuzzing
16 Example command line to build binaries for use with
17 [honggfuzz](https://github.com/google/honggfuzz/):
20 ./configure -C --without-gettext --enable-debug --enable-developer \
21 --address-sanitizer --enable-libfuzzer --abi-check-disable \
22 CC=.../honggfuzz/hfuzz_cc/hfuzz-clang \
23 LINK_CC=.../honggfuzz/hfuzz_cc/hfuzz-clang
29 Example for fuzzing `tiniparser` using `honggfuzz` (see `--help` for more
33 make bin/fuzz_tiniparser && \
34 .../honggfuzz/honggfuzz --sanitizers --timeout 3 --max_file_size 256 \
35 --rlimit_rss 100 -f .../tiniparser-corpus -- bin/fuzz_tiniparser
38 # AFL (american fuzzy lop)
40 ## Configure with fuzzing
42 Example command line to build binaries for use with
43 [afl](http://lcamtuf.coredump.cx/afl/)
46 ./configure -C --without-gettext --enable-debug --enable-developer \
47 --enable-afl-fuzzer --abi-check-disable \
53 Example for fuzzing `tiniparser` using `afl-fuzz` (see `--help` for more
57 make bin/fuzz_tiniparser build && \
58 afl-fuzz -m 200 -i inputdir -o outputdir -- bin/fuzz_tiniparser
63 Samba can be fuzzed by Google's oss-fuzz system. Assuming you have an
64 oss-fuzz checkout from https://github.com/google/oss-fuzz with Samba's
65 metadata in projects/samba, the following guides will help:
69 https://google.github.io/oss-fuzz/getting-started/new-project-guide/#testing-locally
73 See https://google.github.io/oss-fuzz/advanced-topics/debugging/
75 ## Samba-specific hints
77 A typical debugging workflow is:
79 oss-fuzz$ python infra/helper.py shell samba
80 git fetch $REMOTE $BRANCH
81 git checkout FETCH_HEAD
82 lib/fuzzing/oss-fuzz/build_image.sh
85 This will pull in any new Samba deps and build Samba's fuzzers.
87 # vim: set sw=8 sts=8 ts=8 tw=79 :