From: Matthias Maennich <maennich@google.com>
To: libabigail@sourceware.org
Cc: dodji@seketeli.org, kernel-team@android.com, maennich@google.com
Subject: [PATCH] configure: add support for memory sanitizer (--enable-msan)
Date: Wed, 18 Mar 2020 00:18:37 +0100 [thread overview]
Message-ID: <20200317231837.39648-1-maennich@google.com> (raw)
Similarly to asan, tsan and ubsan, add support for msan conditionally at
configure time. This allows us to track down issues caused by using
uninitialized values.
* configure.ac: Add configure options for -fsanitize=memory
Signed-off-by: Matthias Maennich <maennich@google.com>
---
configure.ac | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/configure.ac b/configure.ac
index 50a50c6c8932..9f30ea38cf86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,6 +120,12 @@ AC_ARG_ENABLE(asan,
ENABLE_ASAN=$enableval,
ENABLE_ASAN=no)
+AC_ARG_ENABLE(msan,
+ AS_HELP_STRING([--enable-msan=yes|no],
+ [enable the support of building with -fsanitize=memory)]),
+ ENABLE_MSAN=$enableval,
+ ENABLE_MSAN=no)
+
AC_ARG_ENABLE(tsan,
AS_HELP_STRING([--enable-tsan=yes|no],
[enable the support of building with -fsanitize=thread)]),
@@ -620,6 +626,11 @@ if test x$ENABLE_ASAN = xyes; then
CXXFLAGS="$CXXFLAGS -fsanitize=address"
fi
+if test x$ENABLE_MSAN = xyes; then
+ CFLAGS="$CFLAGS -fsanitize=memory -fsanitize-memory-track-origins"
+ CXXFLAGS="$CXXFLAGS -fsanitize=memory -fsanitize-memory-track-origins"
+fi
+
if test x$ENABLE_TSAN = xyes; then
CFLAGS="$CFLAGS -fsanitize=thread"
CXXFLAGS="$CXXFLAGS -fsanitize=thread"
@@ -918,6 +929,7 @@ AC_MSG_NOTICE([
Enable python 3 : ${ENABLE_PYTHON3}
Enable running tests under Valgrind : ${enable_valgrind}
Enable build with -fsanitize=address : ${ENABLE_ASAN}
+ Enable build with -fsanitize=memory : ${ENABLE_MSAN}
Enable build with -fsanitize=thread : ${ENABLE_TSAN}
Enable build with -fsanitize=undefined : ${ENABLE_UBSAN}
Generate html apidoc : ${ENABLE_APIDOC}
--
2.25.1.481.gfbce0eb801-goog
next reply other threads:[~2020-03-17 23:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-17 23:18 Matthias Maennich [this message]
2020-03-18 21:45 ` Dodji Seketeli
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=20200317231837.39648-1-maennich@google.com \
--to=maennich@google.com \
--cc=dodji@seketeli.org \
--cc=kernel-team@android.com \
--cc=libabigail@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).