mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Re-enable the fuzzing tests
The fuzzing tests were temporarily disabled when the build system has been converted to automake. This commit restores the functionality to run the fuzzing tests as part of the `make check`. When the afl or libfuzzer is enabled via ./configure, it uses a custom LOG_DRIVER (fuzz/<fuzzer.sh>). Currently only libfuzzer.sh has been implemented that runs each fuzz test for 5 seconds each.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
SUBDIRS = . libltdl lib doc bin
|
||||
SUBDIRS = . libltdl lib doc bin fuzz
|
||||
|
||||
BUILT_SOURCES = bind.keys.h
|
||||
CLEANFILES = bind.keys.h
|
||||
|
17
configure.ac
17
configure.ac
@@ -212,13 +212,18 @@ AS_CASE([$enable_fuzzing],
|
||||
AC_MSG_RESULT([using AFL])
|
||||
AC_DEFINE([ENABLE_AFL], [1],
|
||||
[Define to enable American Fuzzy Lop test harness])
|
||||
CFLAGS="$CFLAGS -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1"
|
||||
LIBS="$LIBS -lpthread"],
|
||||
STD_CFLAGS="$STD_CFLAGS -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1"
|
||||
FUZZ_LOG_COMPILER="afl.sh"],
|
||||
[libfuzzer],[
|
||||
AC_MSG_RESULT([using libFuzzer])
|
||||
CFLAGS="$CFLAGS -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1 -fsanitize=fuzzer,address,undefined"
|
||||
LDFLAGS="$LDFLAGS -fsanitize=fuzzer,address,undefined"],
|
||||
STD_CFLAGS="$STD_CFLAGS -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1 -fsanitize=fuzzer-no-link,address,undefined"
|
||||
LDFLAGS="$LDFLAGS -fsanitize=address,undefined"
|
||||
FUZZ_LDFLAGS="-fsanitize=fuzzer,address,undefined"
|
||||
FUZZ_LOG_COMPILER="libfuzzer.sh"],
|
||||
[*],[AC_MSG_ERROR([You need to explicitly select the fuzzer])])
|
||||
AM_CONDITIONAL([HAVE_FUZZ_LOG_COMPILER], [test -n "$FUZZ_LOG_COMPILER"])
|
||||
AC_SUBST([FUZZ_LOG_COMPILER])
|
||||
AC_SUBST([FUZZ_LDFLAGS])
|
||||
|
||||
AS_IF([test "$enable_fuzzing" = "afl"],
|
||||
[AC_MSG_CHECKING("for AFL enabled compiler")
|
||||
@@ -1672,6 +1677,10 @@ AC_CONFIG_FILES([bin/tests/system/start.sh],
|
||||
AC_CONFIG_FILES([bin/tests/system/stop.sh],
|
||||
[chmod +x bin/tests/system/stop.sh])
|
||||
|
||||
# Fuzz Tests
|
||||
|
||||
AC_CONFIG_FILES([fuzz/Makefile])
|
||||
|
||||
# Misc
|
||||
|
||||
AC_CONFIG_FILES([util/check-make-install])
|
||||
|
39
fuzz/Makefile.am
Normal file
39
fuzz/Makefile.am
Normal file
@@ -0,0 +1,39 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
-DFUZZDIR=\"$(abs_srcdir)\"
|
||||
|
||||
AM_LDFLAGS = \
|
||||
$(FUZZ_LDFLAGS)
|
||||
|
||||
LDADD = \
|
||||
libfuzzmain.la \
|
||||
$(LIBISC_LIBS) \
|
||||
$(LIBDNS_LIBS)
|
||||
|
||||
check_LTLIBRARIES = libfuzzmain.la
|
||||
libfuzzmain_la_SOURCES = \
|
||||
main.c
|
||||
|
||||
check_PROGRAMS = \
|
||||
dns_name_fromtext_target \
|
||||
dns_rdata_fromwire_text \
|
||||
isc_lex_getmastertoken \
|
||||
isc_lex_gettoken
|
||||
|
||||
EXTRA_DIST = \
|
||||
dns_name_fromtext_target.in \
|
||||
dns_rdata_fromwire_text.in \
|
||||
isc_lex_getmastertoken.in \
|
||||
isc_lex_gettoken.in
|
||||
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
if HAVE_FUZZ_LOG_COMPILER
|
||||
LOG_COMPILER = $(srcdir)/$(FUZZ_LOG_COMPILER)
|
||||
AM_LOG_FLAGS = $(srcdir)
|
||||
endif HAVE_FUZZ_LOG_COMPILER
|
||||
|
||||
unit-local: check
|
14
fuzz/afl.sh
Executable file
14
fuzz/afl.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
echo "The AFL log compiler is not implemented yet."
|
||||
|
||||
exit 1
|
12
fuzz/libfuzzer.sh
Executable file
12
fuzz/libfuzzer.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh -ex
|
||||
#
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
exec "${2}" "${1}/$(basename "${2}").in" -max_total_time=5 -print_pcs=1 -print_final_stats=1 -print_corpus_stats=1 -print_coverage=1
|
@@ -1236,9 +1236,11 @@
|
||||
./docutil/patch-db2latex-duplicate-template-bug X 2007,2018,2019,2020
|
||||
./docutil/patch-db2latex-nested-param-bug X 2007,2018,2019,2020
|
||||
./docutil/patch-db2latex-xsltproc-title-bug X 2007,2018,2019,2020
|
||||
./fuzz/afl.sh SH 2020
|
||||
./fuzz/dns_name_fromtext_target.c C 2018,2019,2020
|
||||
./fuzz/dns_rdata_fromwire_text.c C 2019,2020
|
||||
./fuzz/fuzz.h C 2018,2019,2020
|
||||
./fuzz/libfuzzer.sh SH 2020
|
||||
./fuzz/main.c C 2018,2019,2020
|
||||
./lib/bind9/api X 2001,2006,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020
|
||||
./lib/bind9/check.c C 2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020
|
||||
|
Reference in New Issue
Block a user