knot-dns/tests-fuzz
Daniel Salzman 536be45f57 tests-fuzz: remove AFL support
The knotd_stdio wrapper is broken and unused. In the context of upcoming
AI tools, it's not worth keeping.
2026-05-01 20:56:37 +02:00
..
check tests-fuzz: remove _libfuzzer from fuzz binaries 2018-01-03 11:21:41 +01:00
fuzz_dname_from_str.in tests-fuzz: add tests for dname to/from string operations 2018-07-02 17:00:43 +02:00
fuzz_dname_to_str.in tests-fuzz: add tests for dname to/from string operations 2018-07-02 17:00:43 +02:00
fuzz_packet.in@69e4a98151 tests-fuzz: update and rename submodules 2018-03-02 09:37:06 +01:00
fuzz_zscanner.in@4cf63e8894 tests-fuzz: update and rename submodules 2018-03-02 09:37:06 +01:00
.gitignore tests-fuzz: remove AFL support 2026-05-01 20:56:37 +02:00
fuzz_dname_from_str.c tests-fuzz: relicense to GPL-2.0-or-later 2025-03-24 09:53:50 +01:00
fuzz_dname_to_str.c tests-fuzz: relicense to GPL-2.0-or-later 2025-03-24 09:53:50 +01:00
fuzz_packet.c tests-fuzz: fix compilation on some platforms 2025-11-25 08:14:34 +01:00
fuzz_zscanner.c tests-fuzz: relicense to GPL-2.0-or-later 2025-03-24 09:53:50 +01:00
main.c tests-fuzz: remove AFL support 2026-05-01 20:56:37 +02:00
Makefile.am tests-fuzz: remove AFL support 2026-05-01 20:56:37 +02:00
README.md tests-fuzz: remove AFL support 2026-05-01 20:56:37 +02:00

Fuzzing with libFuzzer (requires Clang 6.0+)

  1. Ensure Clang with -fsanitize=fuzzer support (e.g. LLVM)
  2. Configure with
    1. ./configure --with-fuzzer --disable-shared --disable-documentation
    2. (You should also add --with-sanitizer= address for ASAN or undefined for UBSAN)
    3. (Add proper CC=clang-6.0 if necessary)
  3. Compile Knot DNS:
    1. make
  4. Create and check the fuzzing binaries
    1. cd tests-fuzz
    2. make check
  5. Download the corpora
    1. git submodule init
    2. git submodule update --recursive --remote
  6. (Optional) add more test cases
    1. ./fuzz_packet -merge=1 fuzz_packet.in <DIR_WITH_NEW_PACKET_TEST_CASES>
    2. ./fuzz_zscanner -merge=1 fuzz_zscanner.in <DIR_WITH_NEW_ZSCANNER_TEST_CASES>
  7. Run the fuzzer
    1. (Set proper symbolizer if necessary export ASAN_SYMBOLIZER_PATH=$(readlink -f `which llvm-symbolizer-6.0`) for ASAN or export UBSAN_SYMBOLIZER_PATH=$(readlink -f `which llvm-symbolizer-6.0`) for UBSAN)
    2. ./fuzz_packet fuzz_packet.in or ./fuzz_zscanner fuzz_zscanner.in
    3. (Add parallel fuzzing -jobs=<CPUS>