Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 279071 - Some catalyst stage4 binaries built on amd64 for x86 get RPATH RUNPATH in ELF dynamic section, interfering with /usr/lib/*.so linker scripts per #4411: libedit.so error for openssh sftp
Summary: Some catalyst stage4 binaries built on amd64 for x86 get RPATH RUNPATH in ELF...
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-25 16:37 UTC by Peter Stuge
Modified: 2009-08-13 10:03 UTC (History)
2 users (show)

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


Attachments
List of all files in /usr/bin which have RPATH RUNPATH attributes (x86_stage4_built_by_catalyst_on_amd64_usr_bin_runpaths.txt,19.71 KB, text/plain)
2009-07-25 16:39 UTC, Peter Stuge
Details
emerge output during openssh build (openssh-5.2_p1-r2.build.log,151.21 KB, text/plain)
2009-07-26 02:59 UTC, Peter Stuge
Details
config.log for openssh build (config.log,631.47 KB, text/plain)
2009-07-26 03:04 UTC, Peter Stuge
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Stuge 2009-07-25 16:37:55 UTC
My everyday system is a catalyst stage4 built on amd64 for x86.

With USE=libedit, openssh pulls in and links with libedit, which works out just fine on many other systems, including an amd64 catalyst stage4 built by same build server.

Unlike the amd64 build, my sftp binary has RPATH and RUNPATH set in the ELF dynamic section:
$ readelf -d /usr/bin/sftp

Dynamic section at offset 0x14ea0 contains 37 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libssl.so.0.9.8]
 0x00000001 (NEEDED)                     Shared library: [libcrypto.so.0.9.8]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [libz.so.1]
 0x00000001 (NEEDED)                     Shared library: [libutil.so.1]
 0x00000001 (NEEDED)                     Shared library: [libnsl.so.1]
 0x00000001 (NEEDED)                     Shared library: [libcrypt.so.1]
 0x00000001 (NEEDED)                     Shared library: [libgssapi_krb5.so.2]
 0x00000001 (NEEDED)                     Shared library: [libkrb5.so.3]
 0x00000001 (NEEDED)                     Shared library: [libk5crypto.so.3]
 0x00000001 (NEEDED)                     Shared library: [libcom_err.so.2]
 0x00000001 (NEEDED)                     Shared library: [libresolv.so.2]
 0x00000001 (NEEDED)                     Shared library: [libedit.so]
 0x00000001 (NEEDED)                     Shared library: [libncurses.so.5]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000f (RPATH)                      Library rpath: [/usr/lib]
 0x0000001d (RUNPATH)                    Library runpath: [/usr/lib]
 0x0000000c (INIT)                       0x8049b24
 0x0000000d (FINI)                       0x805939c
 0x00000004 (HASH)                       0x80481a8
 0x6ffffef5 (GNU_HASH)                   0x8048798
 0x00000005 (STRTAB)                     0x80490e4
 0x00000006 (SYMTAB)                     0x80488e4
 0x0000000a (STRSZ)                      1351 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                     0x805dff4
 0x00000002 (PLTRELSZ)                   848 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x80497d4
 0x00000011 (REL)                        0x80497ac
 0x00000012 (RELSZ)                      40 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x6ffffffe (VERNEED)                    0x804972c
 0x6fffffff (VERNEEDNUM)                 1
 0x6ffffff0 (VERSYM)                     0x804962c
 0x00000000 (NULL)                       0x0

This causes a problem because ld.so will then only load NEEDED libraries from /usr/lib (instead of searching /etc/ld.so.cache as usual) and in my case /usr/lib/libedit.so is a linker script rather than a shared object (see #4411) which throws ld.so off, and I get an error:

$ sftp
sftp: error while loading shared libraries: /usr/lib/libedit.so: invalid ELF header

Overriding the RPATH/RUNPATH works just fine:

$ LD_LIBRARY_PATH=/lib:/usr/lib sftp
usage: sftp [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config]
...


Reproducible: Didn't try

Steps to Reproduce:
The key seems to be that catalyst built on amd64, for x86.
Building stage4 on same amd64 build host but for amd64 with USE=libedit does not produce ssh binaries with RPATH/RUNPATH.

Doing a manual build (tar xfz openssh-5.2p1.tar.gz && cd openssh-5.2p1 && ./configure && make sftp) on my running system does not produce ELF files with RPATH/RUNPATH.



Portage 2.1.6.13 (default/linux/x86/2008.0, gcc-4.3.3, glibc-2.10.1-r0, 2.6.30 i686)
=================================================================
System uname: Linux-2.6.30-i686-Intel-R-_Pentium-R-_M_processor_1.50GHz-with-gentoo-2.0.1
Timestamp of tree: Unknown
app-shells/bash:     4.0_p24
dev-lang/python:     2.5.4-r3, 2.6.2-r1
dev-util/cmake:      2.6.4
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.4.3-r3
sys-apps/sandbox:    2.0
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.5, 1.6.3, 1.9.6-r2, 1.10.2, 1.11
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.29
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/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 /etc/udev/rules.d"
CXXFLAGS="-O2 -march=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://ftp.df.lth.se/pub/gentoo"
LDFLAGS="-Wl,-O1"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac aalib acl acpi ads alsa ao apache2 asx audiofile avcodec bzip2 cairo caps cdb cdda cdparanoia cgi cli crypt cscope cups curl daap dbase dga dri dts dv dvb dvd dvdr encode examples exif fastcgi ffmpeg fftw fileencode flac fontconfig ftp gcj gd gimp glitz graphviz gstreamer gtk iconv idn ieee1394 imagemagick imap imlib ipv6 jbig jpeg jpeg2k kerberos lame latex lcms libcaca libsamplerate libwww lzo mad maildir matroska mhash mms mmx mng mp3 mp4 mpeg mysql mysqli ncurses nptl nptlonly nsplugin ogg openal opengl pam pcntl pdf plotutils png posix pulseaudio python qmail-spp qt3 qt4 quicktime raw readline samba sdl seamonkey session sndfile soap sockets sox speex spell sqlite sqlite3 sse sse2 ssl subversion svg tetex theora threads tiff tk truetype unicode usb v4l v4l2 vorbis win32codecs winbind wma wmf x264 x86 xattr xml xml2 xmlrpc xprint xsl xulrunner xv xvid zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 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 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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="fbdev glint i810 intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa vga via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Peter Stuge 2009-07-25 16:39:44 UTC
Created attachment 199151 [details]
List of all files in /usr/bin which have RPATH RUNPATH attributes
Comment 2 SpanKY gentoo-dev 2009-07-26 02:42:58 UTC
runpath tags changes the initial default list only, it does not *restrict* lookup order in any way

you need to post the actual build logs for one of the packages in question, starting with one of the simpler ones like libtool and jpeg
Comment 3 Peter Stuge 2009-07-26 02:51:01 UTC
Right, the problem here is that /usr/lib/libedit.so exists, so lookup stops, and when it turns out to not be an ELF, ld.so gives up. (This could be a bug in ld.so - should I file also with upstream glibc?)

Anyway, I just finished collecting a build log of openssh seconds before your comment, and I will attach them in just a bit.
Comment 4 Peter Stuge 2009-07-26 02:59:59 UTC
Created attachment 199179 [details]
emerge output during openssh build
Comment 5 Peter Stuge 2009-07-26 03:04:11 UTC
Created attachment 199181 [details]
config.log for openssh build

I have the full /var/tmp/portage/net-misc/openssh-5.2_p1-r2 if more files are needed:

grep -r rpath .|cut -f1 -d:|uniq
./Makefile
./config.status
./configure
./autom4te.cache/output.0
./configure.ac
./config.log
./openbsd-compat/Makefile
./openbsd-compat/regress/Makefile
./survey.sh
Comment 6 SpanKY gentoo-dev 2009-07-26 16:46:08 UTC
do not post things on upstream glibc list.  this is expected behavior iirc.

openssh is not a good example because that is a dupe of Bug 187201
Comment 7 James Earl Spahlinger 2009-07-30 23:40:01 UTC
vapier, feel free to re-assign this as appropriate or close. Thanks.
Comment 8 Andrew Gaffney (RETIRED) gentoo-dev 2009-08-09 23:11:51 UTC
This has nothing to do with catalyst. All catalyst does it run 'emerge' in a chroot.
Comment 9 James Earl Spahlinger 2009-08-10 00:08:09 UTC
Are any other binaries causing issues other then openssh? Otherwise this may be a duplicate of bug 187201.