Add valgrind-3.19.0-ld-so-strncmp.patch

Resolves: #2086540
valgrind: Missing strncmp intercept for ld.so
This commit is contained in:
Mark Wielaard 2022-05-24 15:07:31 +02:00
parent 9445078b8b
commit 60ad2127c3
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,25 @@
commit 947388eb043ea1c44b37df94046e1eee790ad776
Author: Mike Crowe <mac@mcrowe.com>
Date: Mon Sep 9 14:16:16 2019 +0100
Intercept strncmp for glibc ld.so v2.28+
In glibc 5aad5f617892e75d91d4c8fb7594ff35b610c042 (first released in
v2.28) a call to strncmp was added to dl-load.c:is_dst. This causes
valgrind to complain about glibc's highly-optimised strncmp performing
sixteen-byte reads on short strings in ld.so. Let's intercept strncmp in
ld.so too so we use valgrind's simple version to avoid this problem.
diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c
index 3b42b3a87..5396e83be 100644
--- a/shared/vg_replace_strmem.c
+++ b/shared/vg_replace_strmem.c
@@ -710,6 +710,8 @@ static inline void my_exit ( int x )
STRNCMP(VG_Z_LIBC_SONAME, __GI_strncmp)
STRNCMP(VG_Z_LIBC_SONAME, __strncmp_sse2)
STRNCMP(VG_Z_LIBC_SONAME, __strncmp_sse42)
+ STRNCMP(VG_Z_LD_LINUX_SO_2, strncmp)
+ STRNCMP(VG_Z_LD_LINUX_X86_64_SO_2, strncmp)
#elif defined(VGO_freebsd)
STRNCMP(VG_Z_LIBC_SONAME, strncmp)

View File

@ -85,6 +85,9 @@ Patch3: valgrind-3.16.0-some-stack-protector.patch
# Add some -Wl,z,now. # Add some -Wl,z,now.
Patch4: valgrind-3.16.0-some-Wl-z-now.patch Patch4: valgrind-3.16.0-some-Wl-z-now.patch
# KDE#434764 # iconv_open causes ld.so v2.28+ to execute optimised strncmp
Patch5: valgrind-3.19.0-ld-so-strncmp.patch
BuildRequires: make BuildRequires: make
BuildRequires: glibc-devel BuildRequires: glibc-devel
@ -222,6 +225,7 @@ Valgrind User Manual for details.
%patch4 -p1 %patch4 -p1
%endif %endif
%patch5 -p1
%build %build
# LTO triggers undefined symbols in valgrind. Valgrind has a --enable-lto # LTO triggers undefined symbols in valgrind. Valgrind has a --enable-lto
@ -451,6 +455,9 @@ fi
%endif %endif
%changelog %changelog
* Tue May 24 2022 Mark Wielaard <mjw@redhat.com>
- Add valgrind-3.19.0-ld-so-strncmp.patch
* Tue Apr 19 2022 Mark Wielaard <mjw@redhat.com> - 3.19.0-1 * Tue Apr 19 2022 Mark Wielaard <mjw@redhat.com> - 3.19.0-1
- Upgrade to valgrind 3.19.0. Drop old patches. - Upgrade to valgrind 3.19.0. Drop old patches.