This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Segmentation fault in __strstr_sse42


Hi,

I've natively built BusyBox and EGLIBC 2.18 on an i686-unknown-linux-gnu
system with GCC 4.8.2 and EGLIBC 2.17.  I'm now trying to run BusyBox
with EGLIBC 2.18, but I get segmentation faults in __strstr_sse42 with
certain commands.  (This is all done on an Intel SandyBridge CPU, if
that matters.)

Here's a backtrace:

    # gdb bin/busybox
    GNU gdb (GDB) 7.6.2 (Debian 7.6.2-1)
    Copyright (C) 2013 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i486-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>...
    Reading symbols from /root/ports/2014-01-28_i686-linux-glibc/root1/bin/busybox...done.
    (gdb) set sysroot .
    (gdb) core core
    warning: core file may not match specified executable file.
    [New LWP 25260]
    warning: .dynamic section for "./lib/ld-linux.so.2" is not at the expected address (wrong library or version mismatch?)
    warning: Could not load shared library symbols for linux-gate.so.1.
    Do you need "set solib-search-path" or "set sysroot"?
    Core was generated by `grep -F . /etc/issue'.
    Program terminated with signal 11, Segmentation fault.
    #0  0xf76f1b6b in _mm_insert_epi8 (__N=0, __S=46, __D=...) at /usr/lib/gcc/i486-linux-gnu/4.8/include/smmintrin.h:399
    399	  return (__m128i) __builtin_ia32_vec_set_v16qi ((__v16qi)__D,
    (gdb) bt
    #0  0xf76f1b6b in _mm_insert_epi8 (__N=0, __S=46, __D=...) at /usr/lib/gcc/i486-linux-gnu/4.8/include/smmintrin.h:399
    #1  __strstr_sse42 (s1=0x9d37090 "ProteanOS BusyBox/Linux-libre 1.0 \\n \\l", s2=0xffe66930 ".") at ../sysdeps/x86_64/multiarch/strstr.c:211
    #2  0x080c78da in grep_file (file=file@entry=0x9d36f28) at findutils/grep.c:352
    #3  0x080c7ffb in grep_main (argc=4, argv=0xffe65ce0) at findutils/grep.c:790
    #4  0x0804df83 in run_applet_no_and_exit (applet_no=96, argv=argv@entry=0xffe65cd4) at libbb/appletlib.c:759
    #5  0x0804dfa6 in run_applet_and_exit (name=0xffe66928 "grep", argv=argv@entry=0xffe65cd4) at libbb/appletlib.c:766
    #6  0x0804e182 in main (argc=4, argv=0xffe65cd4) at libbb/appletlib.c:823

And another backtrace, from a different BusyBox command that also calls
strstr:

    # gdb bin/busybox
    [...]
    Core was generated by `/usr/bin/printf %s n foo'.
    Program terminated with signal 11, Segmentation fault.
    #0  0xf76f4e65 in __strstr_sse42 (s1=0xfffb192e "%s", s2=0x80f44da ".*") at ../sysdeps/x86_64/multiarch/strstr.c:385
    385	}
    (gdb) bt
    #0  0xf76f4e65 in __strstr_sse42 (s1=0xfffb192e "%s", s2=0x80f44da ".*") at ../sysdeps/x86_64/multiarch/strstr.c:385
    #1  0x080b4c47 in print_direc (format=format@entry=0xfffb192e "%s", fmt_length=2, field_width=field_width@entry=0, precision=0, argument=0xfffb1933 "foo")
        at coreutils/printf.c:172
    #2  0x080b50cb in print_formatted (conv_err=<synthetic pointer>, argv=0xfffb17c0, f=<optimized out>) at coreutils/printf.c:354
    #3  printf_main (argc=3, argv=0xfffb17bc) at coreutils/printf.c:418
    #4  0x0804df83 in run_applet_no_and_exit (applet_no=189, argv=argv@entry=0xfffb17b4) at libbb/appletlib.c:759
    #5  0x0804dfa6 in run_applet_and_exit (name=0xfffb1927 "printf", argv=argv@entry=0xfffb17b4) at libbb/appletlib.c:766
    #6  0x0804e182 in main (argc=3, argv=0xfffb17b4) at libbb/appletlib.c:823

This seems to happen only under certain (stack-related?) conditions;
e.g., `grep -F . /etc/issue` crashes but `busybox grep -F . /etc/issue`
runs fine, even though both run the same busybox binary just with a
different argv[0].  So unfortunately I've so far been unable to reduce
this to a simpler test case.

And BusyBox runs fine with the build system's EGLIBC 2.17 or when built
for x86_64-unknown-linux-gnu.

What more can I do to debug this issue?

Thanks,
-- 
Patrick "P. J." McDermott
  http://www.pehjota.net/
Lead Developer, ProteanOS
  http://www.proteanos.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]