]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Intercept strncmp for glibc ld.so v2.28+
authorMike Crowe <mac@mcrowe.com>
Mon, 9 Sep 2019 13:16:16 +0000 (14:16 +0100)
committerMark Wielaard <mark@klomp.org>
Fri, 13 May 2022 22:41:18 +0000 (00:41 +0200)
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.

NEWS
shared/vg_replace_strmem.c

diff --git a/NEWS b/NEWS
index dac9a1ce2ac6ec995cb5155cd2660d88cc9e6635..4bf76608b707103540a90d863be4c117c44cfda0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -35,6 +35,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather
 than mailing the developers (or mailing lists) directly -- bugs that
 are not entered into bugzilla tend to get forgotten about or ignored.
 
+434764  iconv_open causes ld.so v2.28+ to use optimised strncmp
 446754  Improve error codes from alloc functions under memcheck
 452274  memcheck crashes with Assertion 'sci->status.what == SsIdle' failed
 452779  Valgrind fails to build on FreeBSD 13.0 with llvm-devel (15.0.0)
index 3b42b3a8710b9e0a2c3ccdb411737d1a2ead27d6..5396e83be0ffd683e97fe1775fe511d962eed893 100644 (file)
@@ -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)