Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 198895 - sys-libs/glibc-2.6.1: bus error in ld-linux-x86-64.so.2 when used as executable
Summary: sys-libs/glibc-2.6.1: bus error in ld-linux-x86-64.so.2 when used as executable
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-12 08:17 UTC by Eric Lesage
Modified: 2007-11-12 19:11 UTC (History)
0 users

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


Attachments
Stack trace (stack_trace.txt,2.34 KB, text/plain)
2007-11-12 08:20 UTC, Eric Lesage
Details
readelf output of example affected file (readelf_analysis.txt,14.37 KB, text/plain)
2007-11-12 10:07 UTC, Eric Lesage
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Lesage 2007-11-12 08:17:32 UTC
The loader can be run as an executable to verify that a .so is correctly linked. This is used e.g. by ldd. However, it now crashes on some .so.debug files (created using the splitdebug portage feature).

Reproducible: Always

Steps to Reproduce:
To clarify reproducibility: it always happen on the files it happens on, but it doesn't happen on every .so.debug file.

1. $ /lib/ld-linux-x86-64.so.2 --verify /usr/lib64/debug/usr/lib64/libedc_ecc.so.1.0.debug
(see below for other affected files.)

Actual Results:  
Bus error

Or for ldd:
ldd: exited with unknown exit code (135)

The problem also happens with the --list option (instead of --verify).

Expected Results:  
The program should have exited with return value of 2 (i.e. statically linked file).

The problems occurs on some, but not all .so.debug files.

Here are some .so.debug files on my system which exhibit the problem:

/usr/lib64/debug/usr/lib64/libgimpprint.so.1.1.3.debug
/usr/lib64/debug/usr/lib64/libsensors.so.3.1.4.debug
/usr/lib64/debug/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux/auto/Cairo/Cairo.so.debug
/usr/lib64/debug/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux/auto/Compress/Raw/Zlib/Zlib.so.debug
/usr/lib64/debug/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux/auto/Crypt/SSLeay/SSLeay.so.debug
/usr/lib64/debug/usr/lib64/python2.4/lib-dynload/unicodedata.so.debug


I've experienced this on both amd64 systems I have access to. This did not happen before (I suspect before I upgraded glibc).


cat /var/db/pkg/sys-libs/glibc-2.6.1/CFLAGS 
-pipe -ggdb -O2 -fno-strict-aliasing

cat /var/db/pkg/sys-libs/glibc-2.6.1/CC
x86_64-pc-linux-gnu-gcc

sys-libs/glibc-2.6.1  USE="nls profile -debug -glibc-omitfp (-hardened) (-multilib) (-selinux) -vanilla"


Portage 2.1.3.19 (default-linux/amd64/2007.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.21-gentoo-r4 x86_64)
=================================================================
System uname: 2.6.21-gentoo-r4 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4800+
Timestamp of tree: Mon, 12 Nov 2007 04:46:01 +0000
app-shells/bash:     3.2_p17
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.22-r2
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=k8 -ggdb"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/grass60/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe -march=k8 -ggdb"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks installsources metadata-transfer sandbox sfperms splitdebug strict unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://gentoo.osuosl.org/ http://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://www.gtlib.gatech.edu/pub/gentoo http://gentoo.mirrors.pair.com/ http://gentoo.mirrors.tds.net/gentoo http://mirror.datapipe.net/gentoo "
LINGUAS="en de es fr it jp en_GB eo ja ko nl ru es_ES"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/comp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/crossdev /usr/local/portage/kappa /usr/local/portage/openils"
SYNC="rsync://rsync.ca.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac aalib accessibility acl acpi agg alsa amd64 amr amrnb amrwb animgif apache2 avahi bash-completion beagle berkdb bitmap-fonts bonobo branding bzip2 cairo calendar caps cddb cdr cli cracklib crypt cups curl dbus dia dmi doc dri dv dvd dvdr dvdread eap-tls eds emacs emboss encode esd evo exif exscalibar fam fftw firefox flac floppyboot fontconfig foomaticdb fortran ftp galago gcj gd gdbm gif gimp glep glib glitz glut gnome gpac gpm gps gs gstreamer gtk gtkhtml guile hal howl iconv icu idn ieee1394 imagemagick imlib immqt-bc ipv6 isdnlog jack java jbig jpeg jpeg2k kde kerberos keyring lcms ldap leim libcaca libclamav libedit libnotify lm_sensors logitech-mouse logrotate lua mad mailwrapper mbox midi mikmod mmx mng mono mozbranding mozilla mp3 mp4 mpeg mplayer mudflap musepack ncurses netboot netjack nfs nls no-old-linux nptl nptlonly nsplugin nvtv oav objc offensive ogg openal openexr opengl openmp pam pam_console pam_timestamp pango pcre pdf perl php pic plotutils png postgres postscript ppds pppd profile python qt3 qt3support qt4 quicktime quotas readline reflection resolvconf rle ruby samba sasl sdk sdl sensord serial session slp soundex sox speex spell spl sqlite sqlite3 sse sse2 ssl svg swat szip tcl tcltk tcpd tetex theora thunderbird tiff timidity tk truetype truetype-fonts type1-fonts unicode usb utempter vim-pager vim-syntax vorbis wavpack winbind wmf x264 xattr xbase xcb xcomposite xinerama xinetd xml xml2 xorg xpm xprint xv yaz zeroconf zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse joystick evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en de es fr it jp en_GB eo ja ko nl ru es_ES" USERLAND="GNU" VIDEO_CARDS="nvidia fbdev v4l vesa vga"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Eric Lesage 2007-11-12 08:20:56 UTC
Created attachment 135806 [details]
Stack trace

GDB session: stack trace
Comment 2 SpanKY gentoo-dev 2007-11-12 08:37:17 UTC
.debug files are not ELFs ... i dont know why you expect the ldso to handle them
Comment 3 Eric Lesage 2007-11-12 09:41:22 UTC
Hello,

I don't expect a program just to core dump when analysing an input, even if the input is not what it expects.

In case it's not clear, I don't want it to run the file (of course it can't), hence the "--verify" parameter.

The usual behavior of the loader when verifying a non-ELF file is to return with code 1. When an invalid ELF file (eg. static) is given, it usually returns with code 2.
Comment 4 Eric Lesage 2007-11-12 10:07:24 UTC
Created attachment 135810 [details]
readelf output of example affected file

Hello again,

Upon inspection, .so.debug files are proper ELF files, at least according to readelf. Perhaps something is wrong with some of them, I cannot say...

This was done with:
$ readelf -a /usr/lib/debug/usr/lib64/libedc_ecc.so.1.0.debug
Comment 5 SpanKY gentoo-dev 2007-11-12 19:11:27 UTC
they are not proper ELFs ... readelf can just sometimes construct something somewhat meaningful out of the input

what you want are sanity checks in the ldso to verify the ELF being parsed is valid ... that is not a good idea as all the sanity checks needed will simply slow down the entire system at no benefit

whether you get a message "bus error" or "segfault" or the ldso detects the error and tells you "invalid ELF", it's all the same: it wont work