Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 434224 - sys-apps/busybox-1.20.2 - segmentation fault in `bb' when static linking
Summary: sys-apps/busybox-1.20.2 - segmentation fault in `bb' when static linking
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: HPPA Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 431948
  Show dependency tree
 
Reported: 2012-09-07 15:01 UTC by Jeroen Roovers (RETIRED)
Modified: 2013-08-20 08:31 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
bb gdb output (bb.gdb.out.2,4.32 KB, text/plain)
2012-10-10 20:30 UTC, Jeroen Roovers (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeroen Roovers (RETIRED) gentoo-dev 2012-09-07 15:01:47 UTC
GNU gdb (Gentoo 7.3.1 p2) 7.3.1
Copyright (C) 2011 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 "hppa2.0-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /bin/bb...Reading symbols from /usr/lib/debug/bin/bb.debug...done.
done.
BFD: Warning: /root/core is truncated: expected core file size >= 331776, found: 204800.
[New LWP 8499]
Core was generated by `bb'.
Program terminated with signal 11, Segmentation fault.
#0  0x001088b4 in fork ()
(gdb) thread apply all bt full

Thread 1 (LWP 8499):
#0  0x001088b4 in fork ()
No symbol table info available.
#1  0x00062dc0 in forkshell (jp=0x1dc5a0, n=0x1db18c, mode=0) at shell/ash.c:4868
        pid = <optimized out>
#2  0x0006af20 in evalcommand (cmd=0x1db18c, flags=0) at shell/ash.c:9380
        applet_no = <optimized out>
        null_bltin = {name = 0x1902cc "", builtin = 0x5d27c <bltincmd>}
        smark = {stackp = 0x1db170, stacknxt = 0x1db19c "ls", stacknleft = 464, marknext = 0xfb4e7708}
        argp = <optimized out>
        arglist = {list = 0x1db1a4, lastp = 0x1db1a4}
        varlist = {list = 0x0, lastp = 0xfb4e7950}
        argv = 0x1db1ac
        argc = <optimized out>
        sp = <optimized out>
        cmdentry = {cmdtype = 0, u = {index = -148, cmd = 0xffffff6c, func = 0xffffff6c}}
        jp = 0x1dc5a0
        lastarg = 0x1db19c "ls"
        path = 0xfb4e5b27 "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/hppa2.0-unknown-linux-gnu/gcc-bin/4.5.4:/usr/hppa2.0-unknown-linux-gnu/hppa64-unknown-linux-gnu/gcc-bin/4.6.3:/usr/lib/subver"...
        spclbltin = -1
        status = <optimized out>
        nargv = <optimized out>
        bcmd = <optimized out>
        cmd_is_exec = 0
        pseudovarflag = <optimized out>
#3  0x00066e54 in evaltree (n=Cannot access memory at address 0x148
) at shell/ash.c:8458
        is_or = <optimized out>
        savehandler = 0xfb4e7570
        jmploc = {loc = {{__jmpbuf = {9.5748538780225225e-318, 4.0767124928283548e-308, 3.4758375935842799e-308, 
                4.1123684279586311e-308, 2.1229569778928932e-314, -nan(0xfffffffffffff), 4.5519256082645727e-318, 
                1.1201416797261074e-317, 9.6118692762089487e-318, 4.0506374085492542e-308, 8.9305466060248015e-309, 
                1345813788.9831741, 4.9406564584124654e-324, 5.3432438341383702e-315, 5.3399101755996209e-315, 
                1.4821969375237396e-323, 3.4584595208887258e-322, 4.9406564584124654e-324, 4.9406564584124654e-315, 
                5.3435979803933092e-315, 6.6312375878649447e-316}, __mask_was_saved = 0, __saved_mask = {__val = {4294967295, 1, 
                  1922984, 0, 1921168, 1921168, 1921168, 1923048, 1921168, 921320, 0, 4294967295, 428143, 2268456, 809224, 0, 0, 
                  1921168, 6, 1921168, 1921168, 1921168, 1921168, 1923048, 1945996, 0, 2267192, 0, 921320, 0, 4294967295, 3}}}}}
        checkexit = 0
        evalfn = <optimized out>
        status = <optimized out>
        int_level = 0
#4  0x00069df4 in cmdloop (top=<optimized out>) at shell/ash.c:12189
        skip = <optimized out>
        n = <optimized out>
        smark = {stackp = 0x1db170, stacknxt = 0x1db174 "ls", stacknleft = 504, marknext = 0xfb4e748c}
        inter = <optimized out>
        numeof = 0
#5  0x0006c008 in ash_main (argc=<optimized out>, argv=0xfb4e702c) at shell/ash.c:13228
        shinit = <optimized out>
        state = 4
        jmploc = {loc = {{__jmpbuf = {-9.0524151030390861e+285, 4.0767104097372073e-308, 2.1219957973881257e-314, 0, 
                1.7171699230688477e-308, -nan(0xfffffffffffff), 4.5519256082645727e-318, 1.1201416797261074e-317, 
                9.6250904728916604e-318, 4.0506374085489696e-308, 9.3717307548516648e-309, 1345813788.9831741, 
                4.9406564584124654e-324, 5.3432438341383702e-315, 5.3399101755996209e-315, 1.4821969375237396e-323, 
                3.4584595208887258e-322, 4.9406564584124654e-324, 4.9406564584124654e-315, 5.3435979803933092e-315, 
                6.6312375878649447e-316}, __mask_was_saved = 0, __saved_mask = {__val = {0, 0, 0, 1010323, 1010323, 0, 0, 0, 0, 0, 
                  2267192, 1924552, 921320, 0, 4294967295, 4294967295, 2268456, 809224, 0, 0, 1028379, 794888, 12, 16, 1924496, 
                  1908880, 16, 1924496, 0, 0, 0, 0}}}}}
        smark = {stackp = 0x1db170, stacknxt = 0x1db174 "ls", stacknleft = 504, marknext = 0x0}
#6  0x00010dac in run_applet_no_and_exit (applet_no=13, argv=0xfb4e702c) at libbb/appletlib.c:755
        argc = <optimized out>
#7  0x00010ee8 in run_applet_and_exit (name=0xfb4e48d4 "bb", argv=0xfb4e702c) at libbb/appletlib.c:762
        applet = <optimized out>
#8  0x00011510 in main (argc=<optimized out>, argv=0xfb4e702c) at libbb/appletlib.c:819
No locals.
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2012-09-07 15:03:05 UTC
Running `busybox ls' is no problem, but running the bb shell, and then executing an internal command causes segmentation faults.

Fri Sep  7 17:01:58 CEST 2012
Portage 2.1.11.13 (default/linux/hppa/10.0, gcc-4.5.4, glibc-2.14.1-r3, 3.4.9-gentoo-JeR parisc64)
=================================================================
                        System Settings
=================================================================
System uname: Linux-3.4.9-gentoo-JeR-parisc64-PA8700_-PCX-W2-with-gentoo-2.2
Timestamp of tree: Fri, 07 Sep 2012 03:15:01 +0000
distcc 3.1 hppa2.0-unknown-linux-gnu [enabled]
ccache version 3.1.7 [disabled]
app-shells/bash:          4.2_p37
dev-lang/python:          2.5.4-r4, 2.6.8, 2.7.3-r2
dev-util/ccache:          3.1.7
dev-util/cmake:           2.8.8-r3
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.10.5
sys-apps/sandbox:         2.6
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.6
sys-devel/binutils:       2.21.1-r1, 2.22-r1
sys-devel/gcc:            4.4.5, 4.4.6-r1, 4.4.7, 4.5.1-r1, 4.5.2, 4.5.3-r2, 4.5.4, 4.6.2, 4.6.3, 4.7.0, 4.7.1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.4-r2 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r3
Repositories: gentoo JeR
Installed sets: @system
ACCEPT_KEYWORDS="hppa"
ACCEPT_LICENSE="* -@EULA"
CBUILD="hppa2.0-unknown-linux-gnu"
CFLAGS="-mschedule=8000 -march=2.0 -ggdb -pipe -Wall -O2 -Wno-comment"
CHOST="hppa2.0-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib/distcc/bin /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /var/bind /var/spool/torque /var/vpopmail/etc /var/www/localhost/htdocs/wordpress/wp-config.php"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-mschedule=8000 -march=2.0 -ggdb -pipe -Wall -O2"
DISTDIR="/world/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build=n"
FCFLAGS=""
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distcc distlocks ebuild-locks fixlafiles metadata-transfer news notitles parallel-fetch protect-owned sandbox sfperms splitdebug strict test test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv"
FFLAGS="-mschedule=8000 -march=2.0 -ggdb -pipe -Wall -O2"
GENTOO_MIRRORS="http://de-mirror.org/distro/gentoo/ http://mirror.netcologne.de/gentoo/ http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://gentoo.tiscali.nl/ http://mirror.leaseweb.com/gentoo/ "
LC_ALL="en_US.ISO-8859-1"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
LINGUAS="en nl he"
MAKEOPTS="-j6"
PKGDIR="/keeps/gentoo/packages/elmer"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/mnt/alt"
PORTDIR="/world/gentoo/portage"
PORTDIR_OVERLAY="/keeps/gentoo/local"
SYNC="rsync://rsync.nl.gentoo.org/gentoo-portage"
USE="7zip X Xaw3d a52 aac aacplus aalib abyss accessibility ads afterimage agg alsa amr amrnb amrwb ao aoss apis apng ares artist-screen asf ass assistant async asyncns audiofile augeas automount avfs bash-completion berkdb bidi bittorrent bittorrent-external bl bluetooth bzip2 c++ cairo captury catalogs cblas cdb cdio cdr chardet cjk clarens cleartype cli cman colors contrast cpath cracklib crypt cue cups curl custom-cflags custom-cxxflags cxx dbi dbtool dbus designer designer-plugin device-mapper dga dia dirac directfb djbfft djvu domainkeys dri drm dts dv dvd dvdr dvdread ebook edl egl elf emacs enca encode esd examples exceptions exif expat extras facebook fam fame fastbuild fastcgi fbcon ffmpeg filter fits flac fltk fluidsynth fontconfig foomaticdb fortran fpx frei0r ftp fts3 fusion gadu galago games gcrypt gd gdbm geant4 geoip ggi gif gimp gimpprint glep glib glut gmp gnokii gnutls gphoto2 gpm gps gs gsl gsm gtk gtk2 gtk3 gtkhtml guidexml guile hal hepmc hesiod hotpixels hppa hwdb i18n ical icecast iconv icu idea idn imagemagick imlib indi inotify inquisitio introspection ipv6 isc ithreads jabber jack javascript jbig jingle jpeg jpeg2k judy kate kpathsea lame lapack lasi lastfmradio latex lcms ldap leim lensfun libass libcaca libffi libmms libnl libotf libsamplerate libssh2 libwww live logrotate logwatch lua lyrics-screen lzma lzo m17n-lib mad manhole matroska mbrola mem-scramble memcache metis mhash midi mikmod mmap mms mng modplug modules motif mozbranding mp3 mpg123 mpi mplayer mssql mudflap multislot musepack musicbrainz mysql nagios-dns nagios-game nagios-ntp nagios-ping nagios-ssh nas natspec ncurses netpbm nettle network-cron nfconntrack nfs nls nntp nova nptl nsplugin ntlm objc objc++ objc-gc offensive ogg openal openexr opengl openmp openssl optimization oss ots overlays pam pango pbs pch pcre pdf pdo-external php pipe pkcs11 plasma plotutils plugins png policykit portage portaudio postgres povray ppds pppd pulseaudio python pyzord qalculate qdbm qt3support qt4 quicktime quotas raw readline recode rle romio rpc rrdtool rtc rtmp samba sasl scale0tilt scanner scim sdl seamonkey secure-delete server session sid skk slp smi sms sndfile snmp soap song-screen soundex speex spell spoof-source sqlite srt srtp ssh ssl startup-notification strong-optimization subtitles subversion suhosin supernodal svg swat sysfs syslog system-sqlite talkfilters tcl tcpd test tftp tga theora threads thumbnail thunar-vfs tidy tiff timezone timidity tk tokyocabinet tools truetype tslib tunepimp twolame udev unicode unzip urandom usb userlocales utempter utf v4l v4l2 vala vanim vcd vim-syntax vorbis watchdog wavpack wayland webdav webinstall webp wildmidi winbind wlan wma wmf xanim xcb xchattext xcomposite xetex xface xft xlisten xml xml2 xmp xmpi xnest xpm xrandr xscreensaver xsettings xv xvfb xvid zip zip-external zlib" ALSA_CARDS="ad1889 usb-audio" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="nfs syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev joystick keyboard mouse acecad aiptek calcomp citron digitaledge dmc dynapro elo2300 elographics fpit hyperpen jamstudio magellan microtouch mutouch palmax penmount spaceorb summa tek4957 tslib ur98 wacom void" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en nl he" PHP_TARGETS="php5-3" PYTHON_TARGETS="python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="stifb fbdev none dummy" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LANG, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

sys-apps/busybox-1.20.2 was built with the following:
USE="ipv6 pam test -livecd -make-symlinks -math -mdev -savedconfig (-selinux) -sep-usr -static"
CFLAGS="-mschedule=8000 -march=2.0 -ggdb -pipe -Wall -O2 -Wno-comment -fno-strict-aliasing"
CXXFLAGS="-mschedule=8000 -march=2.0 -ggdb -pipe -Wall -O2 -fno-strict-aliasing"
Comment 2 SpanKY gentoo-dev 2012-09-17 19:46:25 UTC
i don't think it's a bug in busybox, or at least not a regression.  rebuild 1.20.1 and you'll hit the same thing.
Comment 3 SpanKY gentoo-dev 2012-09-18 02:42:07 UTC
seems to be due to static linking
Comment 4 SpanKY gentoo-dev 2012-09-18 04:13:21 UTC
a bare config shows the same bug.  i'd suspect a glibc bug.

CONFIG_HAVE_DOT_CONFIG=y
CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
CONFIG_FEATURE_PREFER_APPLETS=y
CONFIG_NO_DEBUG_LIB=y
CONFIG_INSTALL_APPLET_SYMLINKS=y
CONFIG_LS=y
CONFIG_ASH=y
CONFIG_FEATURE_SH_IS_ASH=y
CONFIG_FEATURE_BASH_IS_NONE=y
CONFIG_FEATURE_SH_STANDALONE=y
CONFIG_FEATURE_SH_NOFORK=y

$ make CONFIG_STATIC=y busybox
$ ./busybox ash
> ls
Comment 5 Carlos O'Donell 2012-10-10 16:14:36 UTC
The hppa fork implementation uses the generic glibc fork implementation, and sets ARCH_FORK to INLINE_SYSCALL (clone ...). There isn't anything here that is different from other architectures.

Can someone use a build of glibc with debug symbols to figure out exactly where this is crashing? Is it before the clone call? After the clone call? In the child? In the parent?

I've not seen this before, but it's not impossible that something has problem.
Comment 6 Carlos O'Donell 2012-10-10 16:16:01 UTC
We need a reduced static linking testcase that uses fork and exhibits the problem, that way an upstream ticket can be filed and fixed.
Comment 7 SpanKY gentoo-dev 2012-10-10 17:28:10 UTC
(In reply to comment #6)

our hppa port is stuck on glibc-2.14 atm, and we've been carrying large patchsets to make hppa work (build/nptl/etc...), so i'm not sure how much this is worth debugging.  probably be better to focus on getting mainline glibc working, and then we'll cut our hppa port over to that (sans our old/hacky patches), and then we can see if this is still crashing.
Comment 8 Carlos O'Donell 2012-10-10 18:32:47 UTC
(In reply to comment #7)
> (In reply to comment #6)
> 
> our hppa port is stuck on glibc-2.14 atm, and we've been carrying large
> patchsets to make hppa work (build/nptl/etc...), so i'm not sure how much
> this is worth debugging.  probably be better to focus on getting mainline
> glibc working, and then we'll cut our hppa port over to that (sans our
> old/hacky patches), and then we can see if this is still crashing.

Agreed. Which is my top priority. I only just recently got my PA8800x2 (SMP) running Gentoo, which should help my testing.
Comment 9 SpanKY gentoo-dev 2012-10-10 19:01:57 UTC
(In reply to comment #8)

if you have any questions, certainly feel free to hassle me :)

we also have #gentoo-hppa on freenode
Comment 10 Jeroen Roovers (RETIRED) gentoo-dev 2012-10-10 20:30:41 UTC
Created attachment 326228 [details]
bb gdb output
Comment 11 Jeroen Roovers (RETIRED) gentoo-dev 2012-10-10 20:33:45 UTC
(In reply to comment #10)
> Created attachment 326228 [details]
> bb gdb output

[ebuild   R   ~] sys-apps/busybox-1.20.2  USE="ipv6 pam -livecd -make-symlinks -math -mdev -savedconfig (-selinux) -sep-usr -static (-systemd)" 0 kB
Comment 12 Jeroen Roovers (RETIRED) gentoo-dev 2012-10-10 20:34:06 UTC
Note that despite USE=-static, it still built a static bb.
Comment 13 SpanKY gentoo-dev 2012-10-10 21:20:55 UTC
(In reply to comment #12)

this is by design.  bb is the system rescue shell which means it is always built as a static program.  you can use it to recover a system where it is the only file in the rootfs.
Comment 14 Guy Martin (RETIRED) gentoo-dev 2013-08-20 08:31:02 UTC
Fixed with glibc-2.17 being stable.