Summary: | iconv_open causes ld.so v2.28 and later to execute optimised strncmp which confuses memcheck | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | Mike Crowe <mac> |
Component: | memcheck | Assignee: | Julian Seward <jseward> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | fweimer, mark |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
See Also: | https://bugzilla.redhat.com/show_bug.cgi?id=2081583 | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
Patch
iconv.c test code Complete valgrind output |
Description
Mike Crowe
2021-03-22 11:58:30 UTC
Created attachment 136942 [details]
iconv.c test code
Created attachment 136943 [details]
Complete valgrind output
I've been unable to reproduce this problem on AArch64 with the current Debian Testing (glibc 2.31 and valgrind 3.17.0.) On some systems the default suppression would have caught this. Specifically this one in glibc-2.X.supp.in: { dl-hack4-64bit-addr-1 Memcheck:Addr8 obj:*/lib*/ld-@GLIBC_VERSION@*.so* obj:*/lib*/ld-@GLIBC_VERSION@*.so* obj:*/lib*/ld-@GLIBC_VERSION@*.so* } But this doesn't match anymore since glibc 2.34 which changed the (in-memory) paths of the glibc library names. The paths were updated for some, but not all suppressions, see: commit a1364805fc74b5690f763033c0c9b43f27613572 Author: Mark Wielaard <mark@klomp.org> Date: Fri Jul 16 15:47:08 2021 -0400 Update helgrind and drd suppression libc and libpthread paths in glibc 2.34 [...] 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. Instead of fixing up those suppressions I think it is better to go with Mike's intercepts. I tried on arm64, armhf, s390x and ppc64le. None would trigger an issue (and none had suppressions). commit 947388eb043ea1c44b37df94046e1eee790ad776 (HEAD -> master) 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. |