From e85e4d880d8c1b70e6e7050d3a3d175deed67eed Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 27 Nov 2015 11:13:06 +0100 Subject: [PATCH] Add configure options to build dnsdist with various sanitizers. It makes it really easy to enable ASAN, LSAN, MSAN, TSAN, or USBSAN on a custom build, to track issues. --- pdns/dnsdistdist/Makefile.am | 5 +++-- pdns/dnsdistdist/configure.ac | 2 ++ pdns/dnsdistdist/m4/pdns_enable_sanitizers.m4 | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) create mode 120000 pdns/dnsdistdist/m4/pdns_enable_sanitizers.m4 diff --git a/pdns/dnsdistdist/Makefile.am b/pdns/dnsdistdist/Makefile.am index 75c9b3b552..e2d53821cb 100644 --- a/pdns/dnsdistdist/Makefile.am +++ b/pdns/dnsdistdist/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -I pdns $(LUA_CFLAGS) $(YAHTTP_CFLAGS) $(BOOST_CPPFLAGS) -I$(CURDIR)/ext/mbedtls/include -O3 -Wall -pthread -DSYSCONFDIR=\"${sysconfdir}\" +AM_CPPFLAGS = -I pdns $(LUA_CFLAGS) $(YAHTTP_CFLAGS) $(BOOST_CPPFLAGS) $(SANITIZER_FLAGS) -I$(CURDIR)/ext/mbedtls/include -O3 -Wall -pthread -DSYSCONFDIR=\"${sysconfdir}\" ACLOCAL_AMFLAGS = -I m4 @@ -67,5 +67,6 @@ dnsdist_LDADD = \ $(READLINE_LIBS) \ $(RT_LIBS) \ $(YAHTTP_LIBS) \ - $(LIBSODIUM_LIBS) + $(LIBSODIUM_LIBS) \ + $(SANITIZER_FLAGS) diff --git a/pdns/dnsdistdist/configure.ac b/pdns/dnsdistdist/configure.ac index 93b3b262a9..026c9f4ba3 100644 --- a/pdns/dnsdistdist/configure.ac +++ b/pdns/dnsdistdist/configure.ac @@ -33,6 +33,8 @@ AS_IF([test "x$enable_hardening" != "xno"], [ AC_LD_RELRO ]) +PDNS_ENABLE_SANITIZERS + LDFLAGS="$RELRO_LDFLAGS $LDFLAGS" AS_IF([test "x$static" != "xyes"], [ diff --git a/pdns/dnsdistdist/m4/pdns_enable_sanitizers.m4 b/pdns/dnsdistdist/m4/pdns_enable_sanitizers.m4 new file mode 120000 index 0000000000..199494fc57 --- /dev/null +++ b/pdns/dnsdistdist/m4/pdns_enable_sanitizers.m4 @@ -0,0 +1 @@ +../../../m4/pdns_enable_sanitizers.m4 \ No newline at end of file -- 2.47.2