[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 19/47] build-sys: add --enable-sanitizers
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 19/47] build-sys: add --enable-sanitizers |
Date: |
Mon, 5 Feb 2018 20:28:33 +0100 |
From: Marc-André Lureau <address@hidden>
Typical slowdown introduced by AddressSanitizer is 2x.
UBSan shouldn't have much impact on runtime cost.
Enable it by default when --enable-debug, unless --disable-sanitizers.
Signed-off-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
configure | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/configure b/configure
index bdbd097..bbfcd9f 100755
--- a/configure
+++ b/configure
@@ -342,6 +342,7 @@ rdma=""
gprof="no"
debug_tcg="no"
debug="no"
+sanitizers=""
fortify_source=""
strip_opt="yes"
tcg_interpreter="no"
@@ -993,6 +994,10 @@ for opt do
strip_opt="no"
fortify_source="no"
;;
+ --enable-sanitizers) sanitizers="yes"
+ ;;
+ --disable-sanitizers) sanitizers="no"
+ ;;
--enable-sparse) sparse="yes"
;;
--disable-sparse) sparse="no"
@@ -1474,6 +1479,7 @@ Advanced options (experts only):
--firmwarepath=PATH search PATH for firmware files
--with-confsuffix=SUFFIX suffix for QEMU data inside
datadir/libdir/sysconfdir [$confsuffix]
--enable-debug enable common debug build options
+ --enable-sanitizers enable default sanitizers
--disable-strip disable stripping binaries
--disable-werror disable compilation abort on warning
--disable-stack-protector disable compiler-provided stack protection
@@ -5201,6 +5207,28 @@ if compile_prog "" "" ; then
fi
##########################################
+# checks for sanitizers
+
+write_c_skeleton
+
+have_asan=no
+have_ubsan=no
+
+# enable sanitizers by default if --enable-debug
+if test "$sanitizers" = "" -a "$debug" = "yes"; then
+ sanitizers=yes
+fi
+
+if test "$sanitizers" = "yes" ; then
+ if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then
+ have_asan=yes
+ fi
+ if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
+ have_ubsan=yes
+ fi
+fi
+
+##########################################
# End of CC checks
# After here, no more $cc or $ld runs
@@ -5224,6 +5252,13 @@ else
CFLAGS="-O2 $CFLAGS"
fi
+if test "$have_asan" = "yes"; then
+ CFLAGS="-fsanitize=address $CFLAGS"
+fi
+if test "$have_ubsan" = "yes"; then
+ CFLAGS="-fsanitize=undefined $CFLAGS"
+fi
+
##########################################
# Do we have libnfs
if test "$libnfs" != "no" ; then
--
1.8.3.1
- [Qemu-devel] [PULL 10/47] readline: don't free completions in readline_free(), (continued)
- [Qemu-devel] [PULL 10/47] readline: don't free completions in readline_free(), Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 08/47] scsi-generic: Simplify error handling code, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 09/47] chardev: fix incorrect unref of source, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 11/47] scripts/qemu-gdb/timers.py: define encoding in header comment, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 12/47] memory-internal.h: Remove obsolete claim that header is obsolete, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 13/47] i2c: Add a CONFIG_I2C master switch to the configuration files, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 14/47] Add missing hvdos public domain attribution:, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 15/47] hvf: ept_emulation_fault() needs NetApp BSD attribution, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 18/47] exynos4210: workaround UBSAN compilation error, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 16/47] Drop remaining bits of ia64 host support, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 19/47] build-sys: add --enable-sanitizers,
Paolo Bonzini <=
- [Qemu-devel] [PULL 21/47] vhost: add traces for memory listeners, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 20/47] ucontext: annotate coroutine stack for ASAN, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 17/47] sockets: fix parsing of ipv4/ipv6 opts in parse_socket_addr, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 23/47] vfio: listener unregister before unset container, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 22/47] arm: postpone device listener unregister, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 25/47] chardev/char-socket: add POLLHUP handler, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 24/47] memory: do explicit cleanup when remove listeners, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 28/47] ivshmem: Improve MSI irqfd error handling, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 29/47] ivshmem: Disable irqfd on device reset, Paolo Bonzini, 2018/02/05
- [Qemu-devel] [PULL 27/47] ivshmem: Always remove irqfd notifiers, Paolo Bonzini, 2018/02/05