From 159cfa5c8645a6020a4e3789417fba916ecfa15f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niels=20M=C3=B6ller?= Date: Fri, 13 Dec 2024 15:19:44 +0100 Subject: [PATCH] Fix problem with configure invocation of valgrind hanging if msan is enabled. --- ChangeLog | 6 ++++++ aclocal.m4 | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8573c786..83d4c982 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-12-13 Niels Möller + + * aclocal.m4 (NETTLE_PROG_VALGRIND): Check if executable appears + to include lsan, asan or msan symbols, and if so, don't attempt to + run valgrind. + 2024-10-16 Niels Möller * run-tests: Cleanup, guided by shellcheck warnings. Use $() diff --git a/aclocal.m4 b/aclocal.m4 index 629db8a7..de7f2331 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -552,7 +552,14 @@ AC_DEFUN([NETTLE_PROG_VALGRIND], [AC_CACHE_CHECK([if valgrind is working], nettle_cv_prog_valgrind, [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [ - if valgrind -q ./conftest$EXEEXT 2>&AS_MESSAGE_LOG_FD; then + # Valgrind is known to work poorly and sometimes hang indefinitely + # on executables built with gcc's leak-sanitizer and + # address-sanitizer, and with clang's memory sanitizer. Attempt to + # work around. See https://bugs.kde.org/show_bug.cgi?id=492255 + if "$NM" ./conftest$EXEEXT 2>&AS_MESSAGE_LOG_FD | + grep '_lsan_\|_msan_\|_asan_' >/dev/null; then + nettle_cv_prog_valgrind=no + elif valgrind -q ./conftest$EXEEXT 2>&AS_MESSAGE_LOG_FD; then nettle_cv_prog_valgrind=yes else nettle_cv_prog_valgrind=no -- 2.47.3