@@ -229,10 +229,10 @@ fi
if [ "$ASAN" ]; then
# This will override default option configured in tests/atlocal.in.
export ASAN_OPTIONS='detect_leaks=1'
+ EXTRA_OPTS="$EXTRA_OPTS --enable-asan"
# -O2 generates few false-positive memory leak reports in test-ovsdb
# application, so lowering optimizations to -O1 here.
- CLFAGS_ASAN="-O1 -fno-omit-frame-pointer -fno-common -fsanitize=address"
- CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${CLFAGS_ASAN}"
+ CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} -O1"
fi
save_OPTS="${OPTS} $*"
@@ -9,6 +9,7 @@ Post-v2.15.0
* New option '--no-record-hostname' to disable hostname configuration
in ovsdb on startup.
* New command 'record-hostname-if-not-set' to update hostname in ovsdb.
+ - New --enable-asan configure option enables AddressSanitizer.
v2.15.0 - 15 Feb 2021
@@ -58,6 +58,22 @@ AC_DEFUN([OVS_ENABLE_WERROR],
fi
AC_SUBST([SPARSE_WERROR])])
+dnl OVS_ENABLE_ASAN
+AC_DEFUN([OVS_ENABLE_ASAN],
+ [AC_ARG_ENABLE(
+ [asan],
+ [AC_HELP_STRING([--enable-asan],
+ [Enable the Address Sanitizer])],
+ [ASAN_ENABLED=yes], [ASAN_ENABLED=no])
+ AC_SUBST([ASAN_ENABLED])
+ AC_CONFIG_COMMANDS_PRE([
+ if test "$ASAN_ENABLED" = "yes"; then
+ OVS_CFLAGS="$OVS_CFLAGS -fno-omit-frame-pointer"
+ OVS_CFLAGS="$OVS_CFLAGS -fno-common -fsanitize=address"
+ fi
+ ])
+ ])
+
dnl OVS_CHECK_LINUX
dnl
dnl Configure linux kernel source tree
@@ -182,6 +182,7 @@ OVS_CONDITIONAL_CC_OPTION([-Wno-unused-parameter], [HAVE_WNO_UNUSED_PARAMETER])
OVS_CONDITIONAL_CC_OPTION([-mavx512f], [HAVE_AVX512F])
OVS_CHECK_CC_OPTION([-mavx512f], [CFLAGS="$CFLAGS -DHAVE_AVX512F"])
OVS_ENABLE_WERROR
+OVS_ENABLE_ASAN
OVS_ENABLE_SPARSE
OVS_CTAGS_IDENTIFIERS
OVS_CHECK_DPCLS_AUTOVALIDATOR
@@ -220,6 +220,7 @@ export OVS_SYSLOG_METHOD
OVS_CTL_TIMEOUT=30
export OVS_CTL_TIMEOUT
+ASAN_ENABLED='@ASAN_ENABLED@'
# Add some default flags to make the tests run better under Address
# Sanitizer, if it was used for the build.
#
Add a configure option to enable ASAN in a simple way. Adding an AC variable to allow checking for support in the testsuite. Signed-off-by: Gaetan Rivet <grive@u256.net> --- .ci/linux-build.sh | 4 ++-- NEWS | 1 + acinclude.m4 | 16 ++++++++++++++++ configure.ac | 1 + tests/atlocal.in | 1 + 5 files changed, 21 insertions(+), 2 deletions(-)