]> git.ipfire.org Git - thirdparty/pdns.git/blame - fuzzing/README.md
Make sure we can install unsigned packages.
[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) ;
aa5a2a6f 15- the Proxy Protocol parser (fuzz_target_proxyprotocol) ;
164ccdcd
RG
16- ZoneParserTNG (fuzz_target_zoneparsertng).
17
18By default the targets are linked against a standalone target,
19pdns/standalone_fuzz_target_runner.cc, which does no fuzzing but makes it easy
20to check a given test file, or just that the fuzzing targets can be built properly.
21
22This behaviour can be changed via the LIB_FUZZING_ENGINE variable, for example
23by setting it to -lFuzzer, building with clang by setting CC=clang CXX=clang++
24before running the configure and adding '-fsanitize=fuzzer-no-link' to CFLAGS
25and CXXFLAGS. Doing so instructs the compiler to instrument the code for
26efficient fuzzing but not to link directly with -lFuzzer, which would make
27the compilation tests done during the configure phase fail.
28
29Sanitizers
30----------
31
44e0b9d2 32In order to catch the maximum of issues during fuzzing, it makes sense to
164ccdcd
RG
33enable the ASAN and UBSAN sanitizers via --enable-asan and --enable-ubsan
34options to the configure, or to set the appropriate flags directly.
35
36Corpus
37------
38
39This directory contains a few files used for continuous fuzzing
40of the PowerDNS products.
41
aa5a2a6f
RG
42The 'corpus' directory contains three sub-directories:
43- proxy-protocol-raw-packets/ contains DNS queries prefixed with a Proxy
44 Protocol v2 header, used by fuzz_target_proxyprotocol ;
164ccdcd
RG
45- raw-dns-packets/ contains DNS queries and responses as captured on
46 the wire. These are used by the fuzz_target_dnsdistcache,
47 fuzz_target_moadnsparser and fuzz_target_packetcache targets ;
48- zones/ contains DNS zones, used by the fuzz_target_zoneparsertng
49 target.
50
51When run in the OSS-Fuzz environment, the zone files from the
52regression-tests/zones/ directory are added to the ones present
53in the fuzzing/corpus/zones/ directory.