Bug 152643

Summary: valgrind - invalid read w/ glibc 2.6.1
Product: [Developer tools] valgrind Reporter: Sylvain BERTRAND <sylvain.bertrand>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: NOR    
Version First Reported In: 3.2.3   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: valgrind -v output of reproduced issue
Test case

Description Sylvain BERTRAND 2007-11-21 10:22:21 UTC
downstream bugs: https://bugs.gentoo.org/show_bug.cgi?id=196802

uname -a:
Linux sbertrand 2.6.22-gentoo-r9 #1 SMP PREEMPT Tue Oct 30 10:48:59 CET 2007
x86_64 Intel(R) Pentium(R) D CPU 3.40GHz GenuineIntel GNU/Linux
Comment 1 Sylvain BERTRAND 2007-11-21 10:24:04 UTC
Created attachment 22140 [details]
valgrind -v output of reproduced issue
Comment 2 Tom Hughes 2007-11-21 10:28:03 UTC
You appear to be reporting an uninitialised memory read in glibc - do you actually have any reason to believe this is a bug in valgrind rather than what it would appear to be at first site, namely an issue in glibc?

Only I can't see anything on the original bug report to suggest that the possibility of a glibc issue has been considered and excluded?
Comment 3 Tom Hughes 2007-11-21 10:30:22 UTC
For what it's worth I get no warnings on Fedora 8 with glibc 2.7 anyway.
Comment 4 Julian Seward 2007-11-21 10:39:35 UTC
I suspect this is happening because ld-2.6.1.so is doing some highly
optimised strlen/strcpy/strcmp stunt which involves reading 8 bytes at
a time.  But because ld-2.6.1.so has basically no symbols, Valgrind
cannot intercept the call and replace it with a non-optimised version
of its own.

Do you have a simple test case we can reproduce this with?

What does  nm /lib64/ld-2.6.1.so  produce?
Comment 5 Julian Seward 2007-11-21 10:44:51 UTC
> ------- Additional Comments From tom compton nu  2007-11-21 10:30 -------
> For what it's worth I get no warnings on Fedora 8 with glibc 2.7 anyway.


Following on from my previous comment, a good way to exacerbate/show up
such problems is to deinstall the glibc-debuginfo package, if you have
one.  The problem (of stripped ld-2.X.Y.so) is now so bad that I 
recently introduced the concept of "mandatory redirections", which 
cause V to stop at startup if the (soname,symbol) pair to redirect cannot
be found when the soname is loaded.  See r7165's commit message for
more details.
Comment 6 Tom Hughes 2007-11-21 10:45:43 UTC
The test case is on the gentoo bug - I'm attaching it here... Compile with:

cc -o x x.c -L/usr/lib64/mysql -lmysqlclient
Comment 7 Tom Hughes 2007-11-21 10:46:09 UTC
Created attachment 22141 [details]
Test case
Comment 8 Tom Hughes 2007-11-21 10:48:16 UTC
I do have the debuginfo rpm installed, but F8 with glibc 2.7 still works even with it removed.
Comment 9 Sylvain BERTRAND 2008-01-14 18:41:00 UTC
Gone with dev-util/valgrind-3.3.0
Comment 10 Sylvain BERTRAND 2008-01-14 18:41:37 UTC
Gone with dev-util/valgrind-3.3.0