]> granicus.if.org Git - pdns/commitdiff
Enable Address (dnsdist, rec) and Undefined Behavior (dnsdist) Sanitizers
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 28 May 2018 07:57:14 +0000 (09:57 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 28 May 2018 15:40:02 +0000 (17:40 +0200)
Enabling UBSAN for the rec triggers a weird linking error in Travis:

> clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)

I haven't been able to reproduce it, it might just be an OOM.

build-scripts/travis.sh

index 43c7263cd21177e6e52726c0f24e669d1de5f12f..18419017b60e9e123c49804f41e2f0f08a2af39c 100755 (executable)
@@ -377,6 +377,7 @@ build_auth() {
   run "autoreconf -vi"
   # Build without --enable-botan, no botan 2.x in Travis CI
   run "./configure \
+    ${sanitizerflags} \
     --with-dynmodules='bind gmysql geoip gpgsql gsqlite3 ldap lua mydns opendbx pipe random remote tinydns godbc lua2' \
     --with-modules='' \
     --with-sqlite3 \
@@ -405,6 +406,7 @@ build_recursor() {
   run "cd pdns-recursor-*"
   # Build without --enable-botan, no botan 2.x in Travis CI
   run "CXX=${COMPILER} ./configure \
+    ${sanitizerflags} \
     --prefix=$PDNS_RECURSOR_DIR \
     --enable-libsodium \
     --enable-unit-tests \
@@ -421,6 +423,7 @@ build_dnsdist(){
   run "tar xf dnsdist*.tar.bz2"
   run "cd dnsdist-*"
   run "./configure \
+    ${sanitizerflags} \
     --enable-unit-tests \
     --enable-libsodium \
     --enable-dnscrypt \
@@ -611,12 +614,20 @@ run "sudo dpkg -i libsodium-dev_1.0.3-1~ppa14.04+1_amd64.deb libsodium13_1.0.3-1
 run "cd ${TRAVIS_BUILD_DIR}"
 
 compilerflags="-O1 -Werror=vla"
+sanitizerflags=""
 if [ "$CC" = "clang" ]
 then
   compilerflags="$compilerflags -Werror=string-plus-int"
+  if [ "${PDNS_BUILD_PRODUCT}" = "recursor" ]; then
+    sanitizerflags="${sanitizerflags} --enable-asan"
+  elif [ "${PDNS_BUILD_PRODUCT}" = "dnsdist" ]; then
+    sanitizerflags="${sanitizerflags} --enable-asan --enable-ubsan"
+  fi
 fi
 export CFLAGS=$compilerflags
 export CXXFLAGS=$compilerflags
+export sanitizerflags
+export UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1"
 
 install_$PDNS_BUILD_PRODUCT