3.17.0-8 - helgrind/drd suppression updates for glibc 2.34

Resolves: #1974357
glibc pthreads updates break helgrind
This commit is contained in:
Mark Wielaard 2021-07-17 20:39:57 +02:00 committed by Mark Wielaard
parent 4a7f098214
commit 6c338d3ed9
4 changed files with 305 additions and 30 deletions

View File

@ -0,0 +1,41 @@
From 6da22a4d246519cd1a638cfc7eff00cdd74413c4 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Fri, 16 Jul 2021 21:37:21 +0200
Subject: [PATCH] gdbserver_tests: update filters for newer glibc/gdb
With newer glibc/gdb we might see a __select call without anything
following on the line. Also when gdb cannot find a file it might
now print "Inappropriate ioctl for device" instead of the message
"No such file or directory"
---
gdbserver_tests/filter_gdb | 1 +
gdbserver_tests/filter_vgdb | 1 +
2 files changed, 2 insertions(+)
diff --git a/gdbserver_tests/filter_gdb b/gdbserver_tests/filter_gdb
index 3bcd26d86..4a5b5d7a5 100755
--- a/gdbserver_tests/filter_gdb
+++ b/gdbserver_tests/filter_gdb
@@ -111,6 +111,7 @@ s/\(0x........\) in ?? ()$/\1 in syscall .../
# If select.c sources are present, we can also get a line containing:
# return SYSCALL_CANCEL....
s/in __select .*/in syscall .../
+s/in __select$/in syscall .../
/exceptfds/d
/sysv\/linux\/select\.c/d
/return SYSCALL_CANCEL /d
diff --git a/gdbserver_tests/filter_vgdb b/gdbserver_tests/filter_vgdb
index f8028a39a..679ca4b31 100755
--- a/gdbserver_tests/filter_vgdb
+++ b/gdbserver_tests/filter_vgdb
@@ -18,6 +18,7 @@ sed -e '/relaying data between gdb and process/d' \
# filter some debuginfo problems with ld.so and SLES11
sed -e '/^1 rtld.c: No such file or directory\./d' |
+sed -e '/rtld.c: Inappropriate ioctl for device\./d' |
# and filter out any remaining empty lines
sed -e '/^$/d'
--
2.27.0

View File

@ -0,0 +1,241 @@
From 5e16f12e5e812d8ed4e3e96f373d73c22c964148 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Fri, 16 Jul 2021 15:47:08 -0400
Subject: [PATCH] Update helgrind and drd suppression libc and libpthread paths
in glibc 2.34
glibc 2.34 moved all pthread functions into the main libc library.
And it changed the (in memory) path of the main libc library to
libc.so.6 (before it was libc-2.xx.so).
This breaks various standard suppressions for helgrind and drd.
Fix this by doing a configure check for whether we are using glibc
2.34 by checking whether pthread_create is in libc instead of in
libpthread. If we are using glibc then define GLIBC_LIBC_PATH and
GLIBC_LIBPTHREAD_PATH variables that point to the (regexp) path
of the library that contains all libc functions and pthread functions
(which will be the same path for glibc 2.34+).
Rename glibc-2.34567-NPTL-helgrind.supp to glibc-2.X-helgrind.supp.in
and glibc-2.X-drd.supp to glibc-2.X-drd.supp.in and replace the
GLIBC_LIBC_PATH and GLIBC_LIBPTHREAD_PATH at configure time.
The same could be done for the glibc-2.X.supp.in file, but hasn't
yet because it looks like most suppressions in that file are obsolete.
---
Makefile.am | 2 +-
configure.ac | 37 +++++++++++++++++--
glibc-2.X-drd.supp => glibc-2.X-drd.supp.in | 6 ++-
...elgrind.supp => glibc-2.X-helgrind.supp.in | 16 ++++----
4 files changed, 47 insertions(+), 14 deletions(-)
rename glibc-2.X-drd.supp => glibc-2.X-drd.supp.in (97%)
rename glibc-2.34567-NPTL-helgrind.supp => glibc-2.X-helgrind.supp.in (95%)
diff --git a/Makefile.am b/Makefile.am
index 66848afaa..f5935eb69 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,7 +41,7 @@ SUPP_FILES = \
glibc-2.2.supp glibc-2.3.supp glibc-2.4.supp glibc-2.5.supp \
glibc-2.6.supp glibc-2.7.supp glibc-2.X.supp.in \
xfree-3.supp xfree-4.supp \
- glibc-2.34567-NPTL-helgrind.supp \
+ glibc-2.X-helgrind.supp \
glibc-2.2-LinuxThreads-helgrind.supp \
glibc-2.X-drd.supp \
darwin9.supp darwin9-drd.supp \
diff --git a/configure.ac b/configure.ac
index 4582fb5d0..beb5bba79 100755
--- a/configure.ac
+++ b/configure.ac
@@ -1090,6 +1090,31 @@ if test x$GLIBC_VERSION = x; then
fi
fi
+# If this is glibc then figure out the generic (in file) libc.so and
+# libpthread.so file paths to use in suppressions. Before 2.34 libpthread
+# was a separate library, afterwards it was merged into libc.so and
+# the library is called libc.so.6 (before it was libc-2.[0-9]+.so).
+# Use this fact to set GLIBC_LIBC_PATH and GLIBC_LIBPTHREAD_PATH.
+case ${GLIBC_VERSION} in
+2*)
+ AC_MSG_CHECKING([whether pthread_create needs libpthread])
+ AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_create])],
+ [
+ AC_MSG_RESULT([no])
+ GLIBC_LIBC_PATH="*/lib*/libc.so.6"
+ GLIBC_LIBPTHREAD_PATH="$GLIBC_LIBC_PATH"
+ ], [
+ AC_MSG_RESULT([yes])
+ GLIBC_LIBC_PATH="*/lib*/libc-2.*so*"
+ GLIBC_LIBPTHREAD_PATH="*/lib*/libpthread-2.*so*"
+ ])
+ ;;
+*)
+ AC_MSG_CHECKING([not glibc...])
+ AC_MSG_RESULT([${GLIBC_VERSION}])
+ ;;
+esac
+
AC_MSG_CHECKING([the glibc version])
case "${GLIBC_VERSION}" in
@@ -1102,13 +1127,13 @@ case "${GLIBC_VERSION}" in
2.[[3-6]])
AC_MSG_RESULT(${GLIBC_VERSION} family)
DEFAULT_SUPP="glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
- DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
+ DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.[[7-9]])
AC_MSG_RESULT(${GLIBC_VERSION} family)
DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
- DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
+ DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.10|2.11)
@@ -1116,7 +1141,7 @@ case "${GLIBC_VERSION}" in
AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
[Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
- DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
+ DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.*)
@@ -1126,7 +1151,7 @@ case "${GLIBC_VERSION}" in
AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
[Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
- DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
+ DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
darwin)
@@ -1157,6 +1182,8 @@ case "${GLIBC_VERSION}" in
esac
AC_SUBST(GLIBC_VERSION)
+AC_SUBST(GLIBC_LIBC_PATH)
+AC_SUBST(GLIBC_LIBPTHREAD_PATH)
if test "$VGCONF_OS" != "solaris"; then
@@ -4928,6 +4955,8 @@ AC_CONFIG_FILES([
valgrind.spec
valgrind.pc
glibc-2.X.supp
+ glibc-2.X-helgrind.supp
+ glibc-2.X-drd.supp
docs/Makefile
tests/Makefile
tests/vg_regtest
diff --git a/glibc-2.X-drd.supp b/glibc-2.X-drd.supp.in
similarity index 97%
rename from glibc-2.X-drd.supp
rename to glibc-2.X-drd.supp.in
index cee5f22fb..2c880051a 100644
--- a/glibc-2.X-drd.supp
+++ b/glibc-2.X-drd.supp.in
@@ -1,3 +1,5 @@
+# IMPORTANT: DO NOT EDIT glibc-2.X-drd.supp, as it is as a generated
+# file. Instead edit glibc-2.X-drd.supp.in.
#
# Suppression patterns for ld, the dynamic loader.
#
@@ -6,7 +8,7 @@
{
drd-ld
drd:ConflictingAccess
- obj:*/lib*/ld-*.so
+ obj:*/lib*/ld*.so*
}
#
@@ -22,7 +24,7 @@
{
drd-libc-stdio
drd:ConflictingAccess
- obj:*/lib*/libc-*
+ obj:@GLIBC_LIBC_PATH@
}
{
drd-libc-thread-cancellation-test
diff --git a/glibc-2.34567-NPTL-helgrind.supp b/glibc-2.X-helgrind.supp.in
similarity index 95%
rename from glibc-2.34567-NPTL-helgrind.supp
rename to glibc-2.X-helgrind.supp.in
index 7ebd2c4b4..cecf3ceab 100644
--- a/glibc-2.34567-NPTL-helgrind.supp
+++ b/glibc-2.X-helgrind.supp.in
@@ -1,3 +1,5 @@
+# IMPORTANT: DO NOT EDIT glibc-2.X-helgrind.supp, as it is as a generated
+# file. Instead edit glibc-2.X-helgrind.supp.in.
# FIXME 22 Jan 09: helgrind-glibc2X-005 overlaps with a lot of
# other stuff. They should be removed.
@@ -41,7 +43,7 @@
{
helgrind-glibc2X-004
Helgrind:Race
- obj:*/lib*/libc-2.*so*
+ obj:@GLIBC_LIBC_PATH@
}
{
@@ -49,13 +51,13 @@
Helgrind:Race
fun:__GI_mempcpy
fun:_IO_*xsputn*
- obj:*/lib*/libc-2.*so*
+ obj:@GLIBC_LIBC_PATH@
}
{
helgrind-glibc2X-005
Helgrind:Race
- obj:*/lib*/libpthread-2.*so*
+ obj:@GLIBC_LIBPTHREAD_PATH@
}
# helgrind-glibc2X-006 was merged into helgrind-glibc2X-005
@@ -90,14 +92,14 @@
{
helgrind-glibc2X-101
Helgrind:Race
- obj:*/lib*/libpthread-2.*so*
+ obj:@GLIBC_LIBPTHREAD_PATH@
fun:pthread_*
}
{
helgrind-glibc2X-102
Helgrind:Race
fun:mythread_wrapper
- obj:*/lib*/libpthread-2.*so*
+ obj:@GLIBC_LIBPTHREAD_PATH@
}
{
helgrind-glibc2X-103
@@ -122,7 +124,7 @@
{
helgrind-glibc2X-107
Helgrind:Race
- obj:*/lib*/libpthread-2.*so*
+ obj:@GLIBC_LIBPTHREAD_PATH@
fun:sem_*
}
{
@@ -138,7 +140,7 @@
{
helgrind-glibc2X-110
Helgrind:Race
- obj:*/lib*/libc-2.*so*
+ obj:@GLIBC_LIBC_PATH@
fun:pthread_*
}
{
--
2.27.0

View File

@ -1,15 +0,0 @@
--- valgrind/glibc-2.34567-NPTL-helgrind.supp.jj 2009-08-19 15:37:48.000000000 +0200
+++ valgrind/glibc-2.34567-NPTL-helgrind.supp 2009-10-21 16:46:31.000000000 +0200
@@ -88,6 +88,12 @@
obj:*/lib*/libpthread-2.*so*
}
{
+ helgrind-glibc2X-102a
+ Helgrind:Race
+ fun:mythread_wrapper
+ obj:*vgpreload_helgrind*.so
+}
+{
helgrind-glibc2X-103
Helgrind:Race
fun:pthread_cond_*@@GLIBC_2.*

View File

@ -3,7 +3,7 @@
Summary: Tool for finding memory management bugs in programs
Name: %{?scl_prefix}valgrind
Version: 3.17.0
Release: 6%{?dist}
Release: 8%{?dist}
Epoch: 1
License: GPLv2+
URL: http://www.valgrind.org/
@ -60,8 +60,7 @@ URL: http://www.valgrind.org/
%global run_full_regtest 1
%endif
%if 0%{?rhel}
# NOTE. CURRENTLY DISABLED ON ALL
%global run_full_regtest 0
%global run_full_regtest (%rhel >= 7)
%endif
%endif
@ -77,9 +76,6 @@ Source0: ftp://sourceware.org/pub/valgrind/valgrind-%{version}.tar.bz2
# Needs investigation and pushing upstream
Patch1: valgrind-3.9.0-cachegrind-improvements.patch
# KDE#211352 - helgrind races in helgrind's own mythread_wrapper
Patch2: valgrind-3.9.0-helgrind-race-supp.patch
# Make ld.so supressions slightly less specific.
Patch3: valgrind-3.9.0-ldso-supp.patch
@ -117,9 +113,6 @@ Patch9: valgrind-3.17.0-debuginfod.patch
# KDE#423963 Only process clone results in the parent thread
Patch10: valgrind-3.17.0-clone-parent-res.patch
# workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100217
Patch11: valgrind-3.17.0-s390x-tests-z14-workaround.patch
# commit d74a637206ef5532ccd2ccb2e31ee2762f184e60
# Bug 433863 - s390x: Remove memcheck test cases for cs, cds, and csg
# commit 18ddcc47c951427efd3b790ba2481159b9bd1598
@ -144,14 +137,21 @@ Patch11: valgrind-3.17.0-s390x-tests-z14-workaround.patch
# s390x: Fix/optimize Iop_64HLtoV128
# commit cae5062b05b95e0303b1122a0ea9aadc197e4f0a
# s390x: Add missing stdout.exp for vector string memcheck test
Patch12: valgrind-3.17.0-s390-prep.patch
Patch11: valgrind-3.17.0-s390-prep.patch
# KDE#432387 - s390x: z15 instructions support
Patch13: valgrind-3.17.0-s390-z15.patch
Patch12: valgrind-3.17.0-s390-z15.patch
# commit 124ae6cfa303f0cc71ffd685620cb57c4f8f02bb
# s390x: Don't emit "vector or with complement" on z13
Patch14: valgrind-3.17.0-s390-z13-vec-fix.patch
Patch13: valgrind-3.17.0-s390-z13-vec-fix.patch
# commit 6da22a4d246519cd1a638cfc7eff00cdd74413c4
# gdbserver_tests: update filters for newer glibc/gdb
Patch14: gdbserver_tests-update-filters-for-newer-glibc-gdb.patch
# KDE#439590 glibc-2.34 breaks suppressions against obj:*/lib*/libc-2.*so*
Patch15: helgrind-and-drd-suppression-libc-and-libpthread.patch
BuildRequires: make
BuildRequires: glibc-devel
@ -285,7 +285,6 @@ Valgrind User Manual for details.
%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
# Old rhel gcc doesn't have -fstack-protector-strong.
@ -299,12 +298,15 @@ Valgrind User Manual for details.
%patch8 -p1
%patch9 -p1
%patch11 -p1
%patch10 -p1
%patch12 -p1
%patch11 -p1
touch memcheck/tests/s390x/vistr.stdout.exp
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%build
# LTO triggers undefined symbols in valgrind. Valgrind has a --enable-lto
@ -530,6 +532,12 @@ fi
%endif
%changelog
* Sat Jul 17 2021 Mark Wielaard <mjw@redhat.com> - 3.17.0-8
- Add gdbserver_tests-update-filters-for-newer-glibc-gdb.patch
- Add helgrind-and-drd-suppression-libc-and-libpthread.patch
- Remove valgrind-3.9.0-helgrind-race-supp.patch
- Enable run_full_regtest.
* Thu Jun 24 2021 Mark Wielaard <mjw@redhat.com> - 3.17.0-6
- Add valgrind-3.17.0-s390-prep.patch
- Add valgrind-3.17.0-s390-z15.patch