]> git.ipfire.org Git - thirdparty/pdns.git/blame - fuzzing/README.md
Merge pull request #7945 from pieterlexis/syncres-CNAME-cache-cleanup
[thirdparty/pdns.git] / fuzzing / README.md
CommitLineData
164ccdcd
RG
1Fuzzing the PowerDNS products
2-----------------------------
3
4This repository contains several fuzzing targets that can be used with generic
5fuzzing engines like AFL and libFuzzer.
6
7These targets are built by passing the --enable-fuzz-targets option to the
8configure, then building as usual. You can also build only these targets
9by going into the pdns/ directory and issuing a 'make fuzz_targets' command.
10
11The current targets cover:
12- the auth, dnsdist and rec packet caches (fuzz_target_packetcache and
13 fuzz_target_dnsdistcache) ;
14- MOADNSParser (fuzz_target_moadnsparser) ;
15- ZoneParserTNG (fuzz_target_zoneparsertng).
16
17By default the targets are linked against a standalone target,
18pdns/standalone_fuzz_target_runner.cc, which does no fuzzing but makes it easy
19to check a given test file, or just that the fuzzing targets can be built properly.
20
21This behaviour can be changed via the LIB_FUZZING_ENGINE variable, for example
22by setting it to -lFuzzer, building with clang by setting CC=clang CXX=clang++
23before running the configure and adding '-fsanitize=fuzzer-no-link' to CFLAGS
24and CXXFLAGS. Doing so instructs the compiler to instrument the code for
25efficient fuzzing but not to link directly with -lFuzzer, which would make
26the compilation tests done during the configure phase fail.
27
28Sanitizers
29----------
30
44e0b9d2 31In order to catch the maximum of issues during fuzzing, it makes sense to
164ccdcd
RG
32enable the ASAN and UBSAN sanitizers via --enable-asan and --enable-ubsan
33options to the configure, or to set the appropriate flags directly.
34
35Corpus
36------
37
38This directory contains a few files used for continuous fuzzing
39of the PowerDNS products.
40
41The 'corpus' directory contains two sub-directories:
42- raw-dns-packets/ contains DNS queries and responses as captured on
43 the wire. These are used by the fuzz_target_dnsdistcache,
44 fuzz_target_moadnsparser and fuzz_target_packetcache targets ;
45- zones/ contains DNS zones, used by the fuzz_target_zoneparsertng
46 target.
47
48When run in the OSS-Fuzz environment, the zone files from the
49regression-tests/zones/ directory are added to the ones present
50in the fuzzing/corpus/zones/ directory.