[extras] add build support for Google's UndefinedBehaviorSanitizer

This commit is contained in:
Michael Rash
2015-12-09 18:19:42 -08:00
parent 60919a9141
commit d509925822
4 changed files with 31 additions and 2 deletions
+1
View File
@@ -70,6 +70,7 @@ EXTRA_DIST = \
extras/ramdisk/ramdisk-create-osx.sh \
extras/console-qr/console-qr.sh \
extras/sanitizer/asan-build.sh \
extras/sanitizer/ubsan-build.sh \
fwknop.spec \
iphone/main.m \
iphone/Fwknop.xcodeproj \
+14 -1
View File
@@ -179,7 +179,7 @@ dnl
want_asan_support=no
AC_ARG_ENABLE([asan-support],
[AS_HELP_STRING([--enable-asan-support],
[Build fwknop binaries with address sanitizer support @<:@default is to disable@:>@])],
[Build fwknop binaries with AddressSanitizer support @<:@default is to disable@:>@])],
[want_asan_support=$enableval],
[])
@@ -187,6 +187,19 @@ if test "x$want_asan_support" = "xyes"; then
FKO_CHECK_COMPILER_ARG([-fsanitize=address -fno-omit-frame-pointer])
fi
dnl Decide whether or not to enable MemorySanitizer support
dnl
want_ubsan_support=no
AC_ARG_ENABLE([ubsan-support],
[AS_HELP_STRING([--enable-ubsan-support],
[Build fwknop binaries with UndefinedBehaviorSanitizer support @<:@default is to disable@:>@])],
[want_ubsan_support=$enableval],
[])
if test "x$want_ubsan_support" = "xyes"; then
FKO_CHECK_COMPILER_ARG([-fsanitize=undefined])
fi
dnl Decide whether or not force 32-bit mode
dnl
want_32bit_mode=no
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh -x
#
# In some cases when enabling Google's Address Sanitizer, errors like the
# In some cases when enabling Google's AddressSanitizer, errors like the
# following can be generated. This script provides a workaround.
#
# fwknop-spa_comm.o: In function `send_spa_packet_http':
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh -x
#
# Enabling Google's UndefinedBehaviorSanitizer
#
if [ -x ./configure ]; then
export ac_cv_func_malloc_0_nonnull=yes
export ac_cv_func_realloc_0_nonnull=yes
./autogen.sh
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/run --enable-ubsan-support $@
make clean
make
else
echo "[*] Execute from the fwknop top level sources directory"
fi