Commit e5dbe2e3b8 for bind
commit e5dbe2e3b8d3667e3c99e8067752711dde8a6a7b
Author: Michal Nowak <mnowak@isc.org>
Date: Wed Jun 3 17:03:54 2026 +0000
Update FUZZING.md for split fuzzing option
Document -Dfuzzing + -Dfuzzing-backend, all four backends, the
cross files and the -Db_lundef=false requirement, replacing the
stale -Dfuzzing=afl/libfuzzer instructions.
Assisted-by: Claude:claude-opus-4-8
diff --git a/fuzz/FUZZING.md b/fuzz/FUZZING.md
index d038d76122..8c1765ee60 100644
--- a/fuzz/FUZZING.md
+++ b/fuzz/FUZZING.md
@@ -13,17 +13,46 @@ information regarding copyright ownership.
= Fuzzing
-The tests in this directory can be operated in three modes:
+Building the fuzzers is controlled by two meson options:
-* non-fuzzing - the test just runs over all input located in `<test_name>.in/`
- directory by compiling with mock main.c that walks through the directory and
- runs `LLVMFuzzerTestOneInput()` over the input files
-* AFL - `meson setup -Dfuzzing=afl` will either feed the stdin to
+* `-Dfuzzing` (feature, `auto` by default) decides whether the fuzzing
+ binaries are built at all.
+* `-Dfuzzing-backend` (`none`, `afl`, `libfuzzer` or `oss-fuzz`, default
+ `none`) selects which backend the binaries are wired up against. The
+ `none` backend still builds the binaries (so that breaking a fuzzer is
+ caught at build time), but they only run in the non-fuzzing mode below.
+
+The tests in this directory can be operated in the following modes:
+
+* non-fuzzing (`-Dfuzzing-backend=none`) - the test just runs over all input
+ located in the `<test_name>.in/` directory by compiling with the mock
+ main.c that walks through the directory and runs
+ `LLVMFuzzerTestOneInput()` over the input files. This is what
+ `meson test --suite fuzz` exercises.
+* AFL (`-Dfuzzing-backend=afl`) - `main.c` will either feed the stdin to
`LLVMFuzzerTestOneInput()` or run the `__AFL_LOOP(10000)` if compiled with
- `afl-clang-fast`. You have to compile using `CC=afl-<gcc|clang>`.
-* LibFuzzer - `meson setup -Dfuzzing=libfuzzer` will disable `main.c`
- completely and it uses the standard LibFuzzer mechanims to feed
- `LLVMFuzzerTestOneInput` with the fuzzer
+ `afl-clang-fast`. You have to compile using an AFL wrapper, e.g.
+ `CC=afl-clang-fast`. The simplest way is the bundled cross file:
+
+ CC=afl-clang-fast meson setup --cross-file fuzz/afl.ini build-afl
+ ninja -C build-afl
+ afl-fuzz -i fuzz/<test_name>.in -o findings -- ./build-afl/<test_name>
+
+* LibFuzzer (`-Dfuzzing-backend=libfuzzer`) - `main.c` is disabled completely
+ and the standard LibFuzzer mechanism feeds `LLVMFuzzerTestOneInput` with the
+ fuzzer. Requires clang; use the bundled cross file:
+
+ meson setup --cross-file fuzz/libfuzzer.ini build-libfuzzer
+ ninja -C build-libfuzzer
+ ./build-libfuzzer/<test_name> fuzz/<test_name>.in
+
+* OSS-Fuzz (`-Dfuzzing-backend=oss-fuzz`) - like LibFuzzer, but the
+ instrumentation and linking flags are supplied externally via
+ `-Doss-fuzz-args=...` (set from the OSS-Fuzz `$CFLAGS`/`$LIB_FUZZING_ENGINE`
+ environment).
+
+Note: with clang-based backends meson must be configured with
+`-Db_lundef=false` (the cross files above already set this).
== Test Cases