strcmp crashes

Bug #518314 reported by Basile Starynkevitch
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
eglibc (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: libc6

system is Ubuntu/Lucid/10.04 alpha2 on amd64, updated febr 06 2010.
Probably same bug as bug 518307.

The following program crashes (but should not, and works ok on Debian/Sid), when compiled with gcc -Wall teststrcmp.c -o teststrcmp (even with -O, or with gcc-4.3, so seems libc6 related).
libc6-dev is 2.11.1-0ubuntu2

// file teststrcmp.c
#include <string.h>
#include <stdio.h>

int main(int argc, char**argv)
{
 int c=0;
 char *s = (argc>1)?argv[1]:"aa";
 printf("s=%p=%s\n", s, s);
 c=strcmp(s, "aa");
 printf("c=%d\n", c);
 return 0;
}
/// eof teststrcmp.c

The crash as reported by gdb is inside strcmp.

description: updated
Revision history for this message
Basile Starynkevitch (basile-starynkevitch) wrote :

Since I scrapped Ubuntu from (and installed Mandriva on) my laptop I am no more able to provide more info & reproduce the bug.

However, I was told that the exact processor matters. Here is the ouptut of cat /proc/cpuinfo:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Core(TM)2 Duo CPU P9500 @ 2.53GHz
stepping : 6
cpu MHz : 800.000
cache size : 6144 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 lahf_lm tpr_shadow vnmi flexpriority
bogomips : 5053.50
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Core(TM)2 Duo CPU P9500 @ 2.53GHz
stepping : 6
cpu MHz : 800.000
cache size : 6144 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 lahf_lm tpr_shadow vnmi flexpriority
bogomips : 5053.73
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

description: updated
Revision history for this message
Kamal Mostafa (kamalmostafa) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. I would like to help resolve the issue, but I cannot reproduce any crash with your test program in Ubuntu Lucid alpha2 (or Karmic) on my amd64 system (Intel Core2 Quad Q9550) with the same libc-dev version you quoted.

You commented that you were "told that the exact processor matters" -- could you clarify that? If you have any additional information about why the processor would matter, or a reference to where you determined that it might, please include that here. It may help to further diagnose the problem.

Thanks again for your bug report, and any additional information you can provide that may help us address it.

Changed in eglibc (Ubuntu):
status: New → Incomplete
Revision history for this message
C de-Avillez (hggdh2) wrote :

Not sure of the real impact, though

Changed in eglibc (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Daniel K (sinani201) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. I would like to help resolve the issue, but I cannot reproduce any crash with your test program in Karmic on my Virtualbox system with the same libc-dev version you quoted.

Revision history for this message
Jarred Holman (jarred-holman) wrote :

I can reproduce this bug on my Lucid x64 VM inside virtualbox.
Processor is an AMD Athlon64 X2 4000+.

libc6: 2.11.1-0ubuntu4
gcc: 4.4.3-3ubuntu3

It definitely seems like a libc bug, the test doesn't crash when gcc uses its builtin strcmp.

The test program crashes when compiled with any of:
gcc -m64 teststrcmp.c
gcc -m64 -O -fno-builtin teststrcmp.c (same with O2, O3)

but works when compiled with any of:
gcc -m64 -O teststrcmp.c (same with O2, O3)
gcc -m32 teststrcmp.c
gcc -m32 -fno-builtin teststrcmp.c

Revision history for this message
Jarred Holman (jarred-holman) wrote :

This bug seems to be fixed with libc6 version 2.11.1-0ubuntu5.
I can no longer reproduce the issue.

Matthias Klose (doko)
Changed in eglibc (Ubuntu):
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.