Created attachment 73821 [details]
Trivial test program; compile and run on RHEL6 to see a glibc suppression pattern that should be added to the defaults
In the SVN trunk HEAD (currently: r12963), glibc-2.X.supp.in, there are many suppressions of the form:
Note that the only difference between the two is the library filename on the 3rd line.
But the RHEL 6-shipped glibc libraries will trip warnings in /lib*/libc-* for *all three lines*. For example, the attached trivial test program uses the argz API in glibc. It trips the following memcheck warning:
==29463== Invalid read of size 8
==29463== at 0x3D5908848D: _wordcopy_fwd_dest_aligned (in /lib64/libc-2.12.so)
==29463== by 0x3D5908211D: __GI_memmove (in /lib64/libc-2.12.so)
==29463== by 0x3D590897DB: argz_insert (in /lib64/libc-2.12.so)
==29463== by 0x400751: main (main.c:19)
==29463== Address 0x4c26110 is 16 bytes inside a block of size 21 alloc'd
==29463== at 0x4A0688E: malloc (vg_replace_malloc.c:270)
==29463== by 0x3D5907F6E1: strdup (in /lib64/libc-2.12.so)
==29463== by 0x4006B9: main (main.c:12)
Note that all three libraries reported are /lib64/libc-*.
At least for this specific error, another default suppression is necessary:
--- glibc-2.X.supp.in (revision 12963)
+++ glibc-2.X.supp.in (working copy)
@@ -80,6 +80,13 @@
I don't know if this is a wider issue or not -- it looks like the glibc-2.X.supp.in file was fairly carefully crafted, so I wouldn't want to arbitrarily just add more suppressions with all 3 libraries being */lib*/libc-*. The attached test program shows the above error, so the patch above (or something like it) would definitely be appreciated if it could be committed for the next valgrind release.
I suspect this just fixes the symptoms. The root problem is that __GI_memmove
didn't get intercepted as it is not listed as one of the variants of memmove that
needs to be intercepted. Get rid of your added suppressions,
and try the patch below. LMK if it helps or not.
--- memcheck/mc_replace_strmem.c (revision 12962)
+++ memcheck/mc_replace_strmem.c (working copy)
@@ -1020,6 +1020,7 @@
+ MEMMOVE(VG_Z_LIBC_SONAME, __GI_memmove)
# if DARWIN_VERS <= DARWIN_10_6
I confirm that your patch fixes the issue.
- I removed my extra suppression
- rebuilt valgrind with your patch
- tested it with my test program
- no warning was issued
(I don't know the normal modus operandi here -- should this be marked as "resolved"?)
No .. the bug stays open until the relevant fix lands.
Fixed, r12982. Fix will be in 3.8.1.