qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PATCH 1/6] build-sys: fix -fsanitize=address check
Date: Thu, 15 Feb 2018 22:25:47 +0100	[thread overview]
Message-ID: <20180215212552.26997-2-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20180215212552.26997-1-marcandre.lureau@redhat.com>

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 <marcandre.lureau@redhat.com>
---
 configure | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 913e14839d..cc610823e1 100755
--- a/configure
+++ b/configure
@@ -5306,25 +5306,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
-- 
2.16.1.73.g5832b7e9f2

  reply	other threads:[~2018-02-15 21:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15 21:25 [Qemu-devel] [PATCH 0/6] vhost-user-test and leak fixes Marc-André Lureau
2018-02-15 21:25 ` Marc-André Lureau [this message]
2018-02-21 19:11   ` [Qemu-devel] [PATCH 1/6] build-sys: fix -fsanitize=address check Emilio G. Cota
2018-02-15 21:25 ` [Qemu-devel] [PATCH 2/6] lockable: workaround GCC link issue with ASAN Marc-André Lureau
2018-02-15 21:25 ` [Qemu-devel] [PATCH 3/6] vhost-user-test: add back memfd check Marc-André Lureau
2018-02-23 14:23   ` Maxime Coquelin
2018-03-16 14:17     ` Marc-André Lureau
2018-03-16 14:41       ` Paolo Bonzini
2018-02-15 21:25 ` [Qemu-devel] [PATCH 4/6] vhost-user-test: do not hang if chardev creation failed Marc-André Lureau
2018-02-23 14:16   ` Maxime Coquelin
2018-02-15 21:25 ` [Qemu-devel] [PATCH 5/6] ahci-test: fix opts leak of skip tests Marc-André Lureau
2018-02-16 20:58   ` John Snow
2018-02-15 21:25 ` [Qemu-devel] [PATCH 6/6] sdhci-test: fix leaks Marc-André Lureau
2018-02-15 21:48   ` Philippe Mathieu-Daudé
2018-02-23 11:37 ` [Qemu-devel] [PATCH 0/6] vhost-user-test and leak fixes Paolo Bonzini
2018-02-23 12:25   ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180215212552.26997-2-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).