Bug 297701 - Another alias for strncasecmp_l in libc-2.13.so
Summary: Another alias for strncasecmp_l in libc-2.13.so
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.7.0
Platform: Compiled Sources Linux
: NOR minor
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-08 03:56 UTC by Adam Greenblatt
Modified: 2012-07-13 13:21 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Greenblatt 2012-04-08 03:56:42 UTC
I compiled a fresh valgrind-3.7.0 on an x86_64 box running Fedora release 14 with the stock
/lib64/libc-2.13.so that comes with that release.  When I run valgrind, I get what I think are spurious
errors of the form:

==11094== Invalid read of size 8
==11094==    at 0x325C887D74: __GI___strncasecmp_l (in /lib64/libc-2.13.so)
==11094==    by 0x325C83A032: ____strtof_l_internal (in /lib64/libc-2.13.so)
==11094==    by 0x4E0DF1: <somewhere in my code>

(I think the errors are spurious because I can insert a call to strlen () prior to the call to
strtof () in my source without getting any additional errors.  If the string in question wasn't
properly null terminated, the strlen () would show an invalid read error after it fell off of the
end of the string.  I'm assuming that libc's strtof and strncasecmp_l implementations are
bug-free, and merely optimized to read 8 bytes at a time.)

Looking in the valgrind sources at memcheck/mc_replace_strmem.c, I see:

#if defined(VGO_linux)
 STRNCASECMP_L(VG_Z_LIBC_SONAME, strncasecmp_l)
 STRNCASECMP_L(VG_Z_LIBC_SONAME, __GI_strncasecmp_l)
 ...

It looks to me like a third alias for strncasecmp_l, with more underscores, is needed:

#if defined(VGO_linux)
 STRNCASECMP_L(VG_Z_LIBC_SONAME, strncasecmp_l)
 STRNCASECMP_L(VG_Z_LIBC_SONAME, __GI_strncasecmp_l)
 STRNCASECMP_L(VG_Z_LIBC_SONAME, __GI___strncasecmp_l)
  ...

If I rebuild valgrind with the above line added and rerun my program under valgrind, the
spurious errors go away.

If this looks reasonable, it would be great if someone could add it to a future release.

Thanks for working on valgrind -- it's a lifesaver!
Comment 1 Julian Seward 2012-07-13 13:21:40 UTC
Committed, r12738.  Thanks.