[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/34] build-sys: fix -fsanitize=address check
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 10/34] build-sys: fix -fsanitize=address check |
Date: |
Tue, 6 Mar 2018 14:19:06 +0100 |
From: Marc-André Lureau <address@hidden>
Since 218bb57dd79d6843e0592c30a82ea8c1fddc74a5, the -fsanitize=address
check fails with:
config-temp/qemu-conf.c:3:20: error: integer overflow in expression
[-Werror=overflow]
return INT32_MIN / -1;
Interestingly, UBSAN check doesn't produce a compile time warning.
Use a test that doesn't have compile time warnings, and make it
specific to UBSAN check.
Signed-off-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Emilio G. Cota <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
configure | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/configure b/configure
index 27d3f66..7ff00f8 100755
--- a/configure
+++ b/configure
@@ -5316,25 +5316,27 @@ fi
##########################################
# checks for sanitizers
-# we could use a simple skeleton for flags checks, but this also
-# detect the static linking issue of ubsan, see also:
-# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
-cat > $TMPC << EOF
-#include <stdint.h>
-int main(void) {
- return INT32_MIN / -1;
-}
-EOF
-
have_asan=no
have_ubsan=no
have_asan_iface_h=no
have_asan_iface_fiber=no
if test "$sanitizers" = "yes" ; then
+ write_c_skeleton
if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then
have_asan=yes
fi
+
+ # we could use a simple skeleton for flags checks, but this also
+ # detect the static linking issue of ubsan, see also:
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
+ cat > $TMPC << EOF
+#include <stdlib.h>
+int main(void) {
+ void *tmp = malloc(10);
+ return *(int *)(tmp + 2);
+}
+EOF
if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
have_ubsan=yes
fi
--
1.8.3.1
- [Qemu-devel] [PULL 00/34] Misc patches for 2018-03-06, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 05/34] cpus: wait for CPU creation at central place, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 04/34] cpus: properly inititalize CPU > 1 under single-threaded TCG, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 01/34] g364fb: fix DirtyBitmapSnapshot leak, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 02/34] Remove the deprecated -tdf option, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 07/34] Document --rtc-td-hack, --localtime and --startdate as deprecated, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 03/34] scsi: Remove automatic creation of SCSI controllers with -drive if=scsi, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 11/34] lockable: workaround GCC link issue with ASAN, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 10/34] build-sys: fix -fsanitize=address check,
Paolo Bonzini <=
- [Qemu-devel] [PULL 08/34] qmp: Merge ObjectPropertyInfo and DevicePropertyInfo, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 06/34] cpus: CPU threads are always created initially for one CPU only, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 09/34] qmp: Add qom-list-properties to list QOM object properties, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 13/34] sdhci-test: fix leaks, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 14/34] chardev: fix leak in tcp_chr_telnet_init_io(), Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 12/34] ahci-test: fix opts leak of skip tests, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 15/34] openpic_kvm: drop address_space_to_flatview call, Paolo Bonzini, 2018/03/06
- [Qemu-devel] [PULL 19/34] address_space_access_valid: address_space_to_flatview needs RCU lock, Paolo Bonzini, 2018/03/06