busybox sed core dump

Bug #615953 reported by Scott Moser
16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
eglibc (Fedora)
Fix Released
High
eglibc (Ubuntu)
Fix Released
Low
Matthias Klose
Lucid
Fix Released
Undecided
Unassigned
Maverick
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: busybox-static

$ echo "a" | busybox sed -e 's,a,b,'
Illegal instruction (core dumped)

$ busybox --help | grep ^Busy
BusyBox v1.15.3 (Ubuntu 1:1.15.3-1ubuntu1) multi-call binary
$ dpkg -S `which busybox`
busybox-static: /bin/busybox
$ dpkg-query --show busybox-static
busybox-static 1:1.15.3-1ubuntu1

I believe this is a problem due to running in xen on ec2. Below is the backtrace from gdb.

#0 0x0806db7d in __strspn_sse42 ()
#1 0x0813a2bb in add_cmd (cmdstr=0x81926c8 "s/a/B/") at editors/sed.c:511
#2 0x0813a71a in add_cmd_block (cmdstr=0x81926c8 "s/a/B/")
    at editors/sed.c:1241
#3 0x0813b249 in sed_main (argc=4, argv=0xbffff214) at editors/sed.c:1298
#4 0x080e7297 in run_applet_no_and_exit (applet_no=144, argv=0x81926c8)
    at libbb/appletlib.c:741
#5 0x080e72b8 in run_applet_and_exit (name=0xbffff36a "sed", argv=0xbffff208)
    at libbb/appletlib.c:748
#6 0x080e749b in busybox_main (name=<value optimized out>, argv=0xbffff208)
    at libbb/appletlib.c:713
#7 run_applet_and_exit (name=<value optimized out>, argv=0xbffff208)
    at libbb/appletlib.c:750
#8 0x080e7504 in main (argc=5, argv=0xbffff204) at libbb/appletlib.c:785

It is moderately annoying, because there is noclean way to really replace busybox-static with busybox , because ubuntu-standard depends on busybox. 'busybox' does not have this problem.

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: busybox-static 1:1.15.3-1ubuntu1
ProcVersionSignature: User Name 2.6.35-14.20-virtual 2.6.35
Uname: Linux 2.6.35-14-virtual i686
Architecture: i386
Date: Tue Aug 10 16:59:00 2010
Ec2AMI: ami-eaa64c83
Ec2AMIManifest: ubuntu-images-testing-us/ubuntu-maverick-daily-i386-server-20100810.manifest.xml
Ec2AvailabilityZone: us-east-1b
Ec2InstanceType: m1.small
Ec2Kernel: aki-407d9529
Ec2Ramdisk: unavailable
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: busybox

Scott Moser (smoser)
description: updated
Revision history for this message
In , Matthew (matthew-redhat-bugs) wrote :

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;
}
#########################

Revision history for this message
In , Eugene (eugene-redhat-bugs) wrote :

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.

Revision history for this message
In , Andreas (andreas-redhat-bugs) wrote :

Looks like the VM is lying about the cpu capabilities. Please provide the contents of /proc/cpuinfo.

Revision history for this message
In , Matthew (matthew-redhat-bugs) wrote :

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

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

glibc-2.12.1-2 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/glibc-2.12.1-2

Revision history for this message
In , Matthew (matthew-redhat-bugs) wrote :

Confirmed - glibc-2.12.1-2 fixes the issue.

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

glibc-2.12.90-8 has been submitted as an update for Fedora 14.
http://admin.fedoraproject.org/updates/glibc-2.12.90-8

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

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.

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

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.

Revision history for this message
Phil Estes (estesp) wrote :

Fixed in glibc.. Fedora/RH bug: https://bugzilla.redhat.com/show_bug.cgi?id=624852

Only affects --static binaries

Revision history for this message
Phil Estes (estesp) wrote :

2010-08-19 Andreas Schwab <email address hidden>
 * sysdeps/i386/i686/multiarch/strspn.S [!SHARED]: Fix SSE4.2 check.
Index: glibc-2.12-2-gc4ccff1/sysdeps/i386/i686/multiarch/strspn.S
===================================================================
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/i386/i686/multiarch/strspn.S
+++ glibc-2.12-2-gc4ccff1/sysdeps/i386/i686/multiarch/strspn.S
@@ -65,7 +65,7 @@ ENTRY(strspn)
  jne 1f
  call __init_cpu_features
 1: leal __strspn_ia32, %eax
- testl $index_SSE2, CPUID_OFFSET+index_SSE4_2+__cpu_features
+ testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features
  jz 2f
  leal __strspn_sse42, %eax
 2: ret

Revision history for this message
Ian Redfern (ian-redfern) wrote :

This is an eglibc bug, not a busybox one - it's hitting me whenever I compile strspn() with --static as shown in the Fedora bug. My CPU flags are:

flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon bts aperfmperf pni monitor vmx est tm2 xtpr pdcm

affects: busybox (Ubuntu) → eglibc (Ubuntu)
Scott Moser (smoser)
Changed in eglibc (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Scott Moser (smoser) wrote :

Fix for this was committed today to eglibc:
http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/natty/eglibc/natty/revision/90
It is in debian/patches/svn-updates.diff.

Changed in eglibc (Ubuntu):
status: Triaged → Fix Committed
Matthias Klose (doko)
Changed in eglibc (Ubuntu Lucid):
status: New → In Progress
Changed in eglibc (Ubuntu Maverick):
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted eglibc into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in eglibc (Ubuntu Lucid):
status: In Progress → Fix Committed
tags: added: verification-needed
Changed in eglibc (Ubuntu Maverick):
status: In Progress → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted eglibc into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Revision history for this message
Steve Beattie (sbeattie) wrote :

I've reproduced the issue with the version of eglibc in maverick-updates, 2.12.1-0ubuntu9, on i386-only, and can confirm that the version in maverick-proposed, 2.12.1-0ubuntu10, fixes it. I've added a testcase for it in the lp:qa-regression-testing tree (http://bazaar.launchpad.net/~ubuntu-bugcontrol/qa-regression-testing/master/revision/1030) and have verified that the version in proposed does not regress with any of the testcases for eglibc in that tree. I've also been running the proposed version of eglibc on 3 different systems with no noticable ill effects.

For lucid, I am unable to reproduce the issue with the version of eglibc in lucid-updates, 2.11.1-0ubuntu7.5, but I can confirm that the version in lucid-proposed, 2.11.1-0ubuntu7.6, also is not affected and that it also passes the rest of the glibc regression tests. Marking verification-done.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Steve Beattie (sbeattie) wrote :

Also, presumably there will have to be a no-change rebuild of busybox and any other package that statically links against eglibc and makes use of strspn, once this SRU goes through.

Revision history for this message
Martin Pitt (pitti) wrote :

Matthias, please fix this in Natty (or close the task if it is already), so that this can progress to -updates. Thanks!

Martin Pitt (pitti)
Changed in eglibc (Ubuntu):
assignee: nobody → Matthias Klose (doko)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package eglibc - 2.11.1-0ubuntu7.6

---------------
eglibc (2.11.1-0ubuntu7.6) lucid-proposed; urgency=low

  * Fix issue #12159, x86-64 strchr propagation of search byte into all bytes
    of SSE register.
  * Fix issue #12113, alignment of AVX safe area on x86_64. LP: #662511.
  * Fix ifunc thunk for strspn on x86 in static libc. LP: #615953.
 -- Matthias Klose <email address hidden> Mon, 15 Nov 2010 00:51:16 +0100

Changed in eglibc (Ubuntu Lucid):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package eglibc - 2.12.1-0ubuntu10

---------------
eglibc (2.12.1-0ubuntu10) maverick-proposed; urgency=low

  * any/cvs-at-pagesize.diff: Don't assume AT_PAGESIZE is always available.
    LP: #672352.
  * Fix issue #12159, x86-64 strchr propagation of search byte into all bytes
    of SSE register.
  * Fix issue12113, alignment of AVX safe area on x86_64. LP: #662511.
  * Fix ifunc thunk for strspn on x86 in static libc. LP: #615953.
 -- Matthias Klose <email address hidden> Sun, 14 Nov 2010 23:49:36 +0100

Changed in eglibc (Ubuntu Maverick):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (6.3 KiB)

This bug was fixed in the package eglibc - 2.12.1-0ubuntu11

---------------
eglibc (2.12.1-0ubuntu11) natty; urgency=low

  * Update to the eglibc 2.12 branch (r12365).
    - Fix alignment of AVX safe area on x86_64, issue #12113. LP: #662511.
    - Fix issue #12159, x86-64 strchr propagation of search byte into all bytes
      of SSE register. (LP: #615953)
    - any/cvs-audit-suid.diff, any/cvs-getlogin_r-error-handling-1.patch,
      any/cvs-getlogin_r-error-handling-2.patch, any/cvs-issue12092.diff,
      any/cvs-getlogin_r-error-handling-3.patch, any/cvs-issue12113.diff,
      any/cvs-issue11968.diff: Remove, merged upstream.
    - any/cvs-dst-expansion-fix.diff, any/submitted-etc-resolv.conf.diff,
      locale/locale-print-LANGUAGE.diff: Updated.

  * Sort changelog entries with bzr-builddeb's merge_changelog to help merging
    with Debian; update Debian changelog entries to their latest version, and
    drop Debian changelog entries which aren't in the unstable changelog; this
    keeps the diff between Debian unstable's changelog and Ubuntu's changelog
    minimal (only Ubuntu entries) and makes it easier to review new Debian
    changes.
  * Copy binutils [mips mipsel] build-dep to minimize delta with Debian's
    build-deps.
  * Drop Vcs-Bzr; this package is now maintained in lp:ubuntu/eglibc.
  * Drop version in texinfo build-dep; this is satisfied even in dapper.
  * Move belocs-locales-bin conflicts around to lower the diff with Debian's
    control.
  * Copy Debian's libc6-dev-i386 Conflicts with libc6-i386 (<= 2.9-18) for
    some older upgrades; this seems to apply to Ubuntu as well, and reduces
    the delta with Debian just a bit. libc6-dev-i386 is not a commonly
    installed package, and this is satisfied in lucid and later anyway, so it
    shouldn't make upgrades harder, except if people use backports.
  * Drop debian/control.in/libc0.1, libc0.3, libc6, and libc6.1 (these are
    automatically generated) after confirming that generating them results in
    the same data.
  * Drop debian/debhelper.in/glibc-doc.docs; ChangeLog* is already listed in
    debian/debhelper.in/glibc-doc.install.
  * Drop debian/debhelper.in/libc-alt-dev.postinst as it only helps powerpc
    upgrades from dapper versions which aren't supported on powerpc anymore.
  * debian/debhelper.in/libc.postinst: drop inconsistent quotes around 2.12.
  * debian/local/manpages/gencat.1, iconvconfig.8, mtrace.1: revert differing
    RCS timestamps.
  * debian/patches/series: drop reference to changelog version with respect to
    local-ipv6-lookup.diff as the reference is bogus.
  * Drop debian/patches/alpha/submitted-getsysstats.diff,
    submitted-includes.diff, submitted-lowlevellock.diff,
    submitted-procfs_h.diff; these should have been dropped in earlier merges
    as they are not applied anymore and were dropped from Debian.
  * Drop commented-out hppa/* lines from patches/series to be consistent with
    how other arches were handled.
  * debian/sysdeps/amd64.mk: symlink ld-linux with the same rune as Debian.
  * Drop changes to debian/sysdeps/hurd.mk; Ubuntu doesn't build for Hurd.
  * Remove debian/wrapper/objcopy; was dropped in Debian already...

Read more...

Changed in eglibc (Ubuntu):
status: Fix Committed → Fix Released
Changed in eglibc (Fedora):
importance: Unknown → High
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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