Bug 624852 - Illegal Instruction with static strspn() app
Summary: Illegal Instruction with static strspn() app
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 13
Hardware: i686
OS: Linux
low
high
Target Milestone: ---
Assignee: Andreas Schwab
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-08-17 22:39 UTC by Matthew Hungerford
Modified: 2016-11-24 16:11 UTC (History)
4 users (show)

Fixed In Version: glibc-2.12.1-2
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 631011 (view as bug list)
Environment:
Last Closed: 2010-08-20 18:04:28 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Matthew Hungerford 2010-08-17 22:39:20 UTC
Description of problem:
compiling a minimal test application statically using gcc, the call strspn() causes a SIGILL.  Prints "Illegal instruction" on the command line.

Changing "char var[]" to "char *var" for strtext and cset causes the problem to decrease from always occuring despite optimization level to occuring only during -O0.

Does not occur for dynamically linked application.

Version-Release number of selected component (if applicable):
glibc-static-2.12-3

How reproducible:
Every time.

Steps to Reproduce:
1. Compile main.c below (strspn test) with "gcc main.c -g -static -O0 -o testapp.bin"
2. Run ./testapp.bin
3. Run gdb ./testapp.bin
  
Actual results:
When ran from the command line, output is "Illegal instruction"
When ran from the debugger, output is 
Program received signal SIGILL, Illegal instruction.
0x08052f5d in __strspn_sse42 ()

Expected results:
Prints-"The length of initial number is 3."

Additional info:
#######main.c############
#include <stdio.h>
#include <string.h>

int main (int argc, char *argv[]){
   char strtext[] = "129th";
   char cset[]    = "1234567890";
   int i;

   i = strspn( strtext, cset );
   printf ( "The length of initial number is %d.\n", i );

   return 0;
}
#########################

Comment 1 Eugene Zobachev 2010-08-17 23:25:01 UTC
Eugene Zobachev 2010-08-17  17:58:14 CDT

I have experienced exactly same problem with the similar code.
The code was compiled and executed on the same computer (Linux server
with Fedora 13).
Surprisingly, this code executes correctly in Ubuntu QEMU and KVN
from the flash drive with Fedora 13, whereas Windows QEMU indicates 
same error ("Illegal instruction" in __strspn_sse42).

Additional information:
If you change "strspn" to "strcspn" in the code fragment above,
the static build works fine.

Comment 2 Andreas Schwab 2010-08-18 08:55:53 UTC
Looks like the VM is lying about the cpu capabilities.  Please provide the contents of /proc/cpuinfo.

Comment 3 Matthew Hungerford 2010-08-18 14:01:42 UTC
For the original post, it was on actual hardware.  
My /proc/cpuinfo is 
vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
stepping        : 10
cpu MHz         : 2992.402
...
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority

Comment 4 Fedora Update System 2010-08-20 08:48:39 UTC
glibc-2.12.1-2 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/glibc-2.12.1-2

Comment 5 Matthew Hungerford 2010-08-20 18:04:28 UTC
Confirmed - glibc-2.12.1-2 fixes the issue.

Comment 6 Fedora Update System 2010-08-23 12:57:58 UTC
glibc-2.12.90-8 has been submitted as an update for Fedora 14.
http://admin.fedoraproject.org/updates/glibc-2.12.90-8

Comment 7 Fedora Update System 2010-09-01 05:43:43 UTC
glibc-2.12.90-8 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2010-09-24 20:37:32 UTC
glibc-2.12.1-2 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.