Bug 256600

Summary: super-optimized strcasecmp() false positive
Product: [Developer tools] valgrind Reporter: Dmitry Djachenko <dimhen>
Component: memcheckAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: minor CC: dimhen, jakub, pavelo, tom
Priority: NOR    
Version: 3.7 SVN   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: add support for strcasecmp/strncasecmp
valgrind-3.6.0-strcasecmp.patch

Description Dmitry Djachenko 2010-11-11 13:53:43 UTC
Created attachment 53319 [details]
add support for strcasecmp/strncasecmp

Version:           3.7 SVN
OS:                Linux



Reproducible: Didn't try


Actual Results:  
==23300== Use of uninitialised value of size 8
==23300==    at 0x33D63277E4: __strncasecmp_l_sse42 (strcmp.S:402)

Expected Results:  
no diagnostique

Fedora14/x64 gcc-4.5.1
Comment 1 Jakub Jelinek 2010-11-11 18:41:24 UTC
Yeah, this is quite severe problem in valgrind against recentish glibcs.

+/* ??? STRCASECMP(VG_Z_LD_LINUX_X86_64_SO_2, strcasecmp) */
+/* ??? STRCASECMP(VG_Z_LD64_SO_1,            strcasecmp) */

is unnecessary, neither strcasecmp nor strncasecmp is ever present in ld.so.

That said, the patch should also handle strcasecmp_l and strncasecmp_l, which will need some configure magic to detect tolower_l/strcasecmp_l.

This could be also solvable using suppressions, but then we wouldn't diagnose invalid uses of strcasecmp by the apps.
Comment 2 Tom Hughes 2010-11-12 01:17:19 UTC
What do the _l variants do? They don't seem to have any manual page on my F14 systems...
Comment 4 Jakub Jelinek 2010-11-12 10:50:25 UTC
Created attachment 53355 [details]
valgrind-3.6.0-strcasecmp.patch

Updated patch to also handle strcasecmp_l and strncasecmp_l.
Comment 5 Tom Hughes 2010-11-12 11:14:12 UTC
Looks like we crossed - I just committed an extended version of the patch as r11478.
Comment 6 Tom Hughes 2011-09-28 18:26:37 UTC
*** Bug 282979 has been marked as a duplicate of this bug. ***