s3: libsmb: Cleanup in get_dc_list()
[Samba.git] / lib / fuzzing / README.md
blob5a2482412480ff5aa48bc860079b0bcf2940d8eb
1 # Fuzzing Samba
3 Fuzzing supplies valid, invalid, unexpected or random data as input to a piece
4 of code. Instrumentation, usually compiler-implemented, is used to monitor for
5 exceptions such as crashes, assertions or memory corruption.
7 See [Wikipedia article on fuzzing](https://en.wikipedia.org/wiki/Fuzzing) for
8 more information.
10 # Hongfuzz
12 ## Configure with fuzzing
14 Example command line to build binaries for use with
15 [honggfuzz](https://github.com/google/honggfuzz/):
17 ```sh
18 buildtools/bin/waf -C --without-gettext --enable-debug --enable-developer \
19         --address-sanitizer --enable-libfuzzer --abi-check-disable \
20         CC=.../honggfuzz/hfuzz_cc/hfuzz-clang configure \
21         LINK_CC=.../honggfuzz/hfuzz_cc/hfuzz-clang
22 ```
25 ## Fuzzing tiniparser
27 Example for fuzzing `tiniparser` using `honggfuzz` (see `--help` for more
28 options):
30 ```sh
31 buildtools/bin/waf --targets=fuzz_tiniparser build && \
32 .../honggfuzz/honggfuzz --sanitizers --timeout 3 --max_file_size 256 \
33   --rlimit_rss 100 -f .../tiniparser-corpus -- bin/fuzz_tiniparser
34 ```
36 # AFL (american fuzzy lop)
38 ## Configure with fuzzing
40 Example command line to build binaries for use with
41 [afl](http://lcamtuf.coredump.cx/afl/)
43 ```sh
44 buildtools/bin/waf -C --without-gettext --enable-debug --enable-developer \
45         --enable-afl-fuzzer --abi-check-disable \
46         CC=afl-gcc configure
47 ```
49 ## Fuzzing tiniparser
51 Example for fuzzing `tiniparser` using `afl-fuzz` (see `--help` for more
52 options):
54 ```sh
55 buildtools/bin/waf --targets=fuzz_tiniparser build && \
56 afl-fuzz -m 200 -i inputdir -o outputdir -- bin/fuzz_tiniparser
57 ```
59 # oss-fuzz
61 Samba can be fuzzed by Google's oss-fuzz system.  Assuming you have an
62 oss-fuzz checkout from https://github.com/google/oss-fuzz with Samba's
63 metadata in projects/samba, the following guides will help:
65 ## Testing locally
67 https://google.github.io/oss-fuzz/getting-started/new-project-guide/#testing-locally
69 ## Debugging oss-fuzz
71 See https://google.github.io/oss-fuzz/advanced-topics/debugging/
73 ## Samba-specific hints
75 A typical debugging workflow is:
77 oss-fuzz$ python infra/helper.py shell samba
78 git fetch $REMOTE $BRANCH
79 git checkout FETCH_HEAD
80 lib/fuzzing/oss-fuzz/build_image.sh
81 compile
83 This will pull in any new Samba deps and build Samba's fuzzers.
85 # vim: set sw=8 sts=8 ts=8 tw=79 :