Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 434856

Summary: sys-libs/glibc: hardfp ldso rename sometimes causes binaries to segfault when mixing old/new ldso names
Product: Gentoo Linux Reporter: William Throwe <wtt6>
Component: [OLD] Core systemAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED WORKSFORME    
Severity: normal CC: arm
Priority: Normal    
Version: unspecified   
Hardware: ARM   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: glib-2.17.log.gz

Description William Throwe 2012-09-13 03:23:55 UTC
After upgrading to the new stable glibc, various programs have started segfaulting.  The ones I have noticed so far are ssh, groff, and fsck.ext3.  ssh was fixed by a rebuild of net-misc/openssh, but sys-apps/groff fails because the new groff binary it produces segfaults.  I have not attempted to rebuild sys-fs/e2fsprogs yet.

A few other packages were upgraded at the same time as glibc, but none of them are linked against by groff, so they seem unlikely to be the problem.

stracing the bad binaries does not reveal any pattern.  I do not have debugging symbols available, so gdb backtraces do not reveal too much, but many of them report stack corruption.


$ emerge --info glibc
Portage 2.1.11.9 (default/linux/arm/10.0, gcc-4.5.3, glibc-2.15-r2, 2.6.31.14.22-efikamx armv7l)
=================================================================
                        System Settings
=================================================================
System uname: Linux-2.6.31.14.22-efikamx-armv7l-ARMv7_Processor_rev_5_-v7l-with-gentoo-2.1
Timestamp of tree: Wed, 12 Sep 2012 06:45:01 +0000
distcc 3.1 armv7a-hardfloat-linux-gnueabi [enabled]
app-shells/bash:          4.2_p37
dev-lang/python:          2.7.3-r2, 3.2.3
dev-util/cmake:           2.8.7-r5
dev-util/pkgconfig:       0.27
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.11.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.5.3-r2
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.15-r2
Repositories: gentoo
ACCEPT_KEYWORDS="arm"
ACCEPT_LICENSE="@FREE"
CBUILD="armv7a-hardfloat-linux-gnueabi"
CFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
CHOST="armv7a-hardfloat-linux-gnueabi"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /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="-O2 -pipe -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--ask"
FCFLAGS="-O2"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distcc ebuild-locks fixlafiles news parse-eapi-ebuild-head protect-owned sandbox sfperms skiprocheck strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2"
GENTOO_MIRRORS="http://gentoo.netnitco.net http://mirror.mcs.anl.gov/pub/gentoo/ http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://mirror.datapipe.net/gentoo ftp://mirror.datapipe.net/gentoo"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--no-keep-memory,--reduce-memory-overheads"
MAKEOPTS="-j5 -l2"
PKGDIR="/usr/portage/packages"
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="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X acl arm berkdb bindist bzip2 cairo cli cracklib crypt cxx emacs fortran gdbm gpm gtk iconv jpeg latex modules mudflap ncurses nptl openmp pam pcre png pppd readline session ssl system-sqlite tcpd truetype unicode zlib" 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" 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" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_TARGETS="python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="exynos fbdev omap omapfb dummy v4l" 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, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

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

sys-libs/glibc-2.15-r2 was built with the following:
USE="-debug -gd (-hardened) (-multilib) -profile (-selinux) -vanilla"
CFLAGS="-pipe -march=armv7-a -mfpu=vfpv3 -O2 -fno-strict-aliasing"
CXXFLAGS="-pipe -march=armv7-a -mfpu=vfpv3 -O2 -fno-strict-aliasing"
Comment 1 William Throwe 2013-01-14 04:35:09 UTC
Finally got around to investigating this some more.  The problem persists with glibc 2.15-r3, but goes away with USE=vanilla, so this is caused by one of Gentoo's patches.

Unfortunately, with 68 patches and glibc taking a few hours to build, I'm not sure when I'll have the time to determine which one is the problem.
Comment 2 Steev Klimaszewski (RETIRED) gentoo-dev 2013-01-14 20:06:31 UTC
Hi William,

Which EfikaMX are you having this issue on (is it a smarttop or a smartbook, if smarttop is it a TO2 or a TO3?)  I can't reproduce this issue here at all, but I don't think I have a smartbook around that had a 2.14 glibc that was upgraded to 2.15, they are all done with newer stages that started with a 2.15 glibc.
Comment 3 SpanKY gentoo-dev 2013-01-15 03:32:24 UTC
(In reply to comment #1)

so try glibc-2.17
Comment 4 William Throwe 2013-01-15 03:51:58 UTC
(In reply to comment #2)
> Hi William,
> 
> Which EfikaMX are you having this issue on (is it a smarttop or a smartbook,
> if smarttop is it a TO2 or a TO3?)  I can't reproduce this issue here at
> all, but I don't think I have a smartbook around that had a 2.14 glibc that
> was upgraded to 2.15, they are all done with newer stages that started with
> a 2.15 glibc.

My machine is a smartbook.

(In reply to comment #3)
> (In reply to comment #1)
> 
> so try glibc-2.17

Will do.  Might take me a few days.
Comment 5 William Throwe 2013-01-16 14:06:18 UTC
Created attachment 335820 [details]
glib-2.17.log.gz

glibc-2.17 fails a preinst sanity check:

/bin/date: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory
 * ERROR: sys-libs/glibc-2.17 failed (preinst phase):
 *   simple run test (/bin/date) failed


Let me know if I should file a separate bug for this.
Comment 6 SpanKY gentoo-dev 2013-01-23 05:22:40 UTC
(In reply to comment #5)

yes, that's a different bug.  please file a new report.
Comment 7 William Throwe 2013-01-24 03:31:09 UTC
(In reply to comment #6)
> (In reply to comment #5)
> 
> yes, that's a different bug.  please file a new report.

Filed as bug #453760.
Comment 8 William Throwe 2013-03-05 05:12:33 UTC
Alright, I think I've sort of figured this out.

I ran a binary search on the patches, and everything seems to work if I exclude just 6226_all_arm-glibc-2.15-hardfp.patch .  As far as I can tell, all this patch does is rename ld-linux.so.3 to ld-linux-armhf.so.3 and change its SONAME.

After recompiling again with the patch, I noticed that some libraries and executables have NEEDED entries for ld-linux.so.3, and when run with the new ld-linux-armhf.so.3 many of them segfault.  I do not know why these aren't just failing at runtime link because the SONAME of ld-linux changed, but they aren't.  This is presumably also why revdep-rebuild doesn't detect them.

One of these libraries is libstdc++.so.  Installing a newer slot of gcc (so the newer libstdc++.so is used) makes groff stop segfaulting.  The openssh executables have the NEEDED entry, and remerging openssh makes them stop segfaulting.  It looks like the problem will be solved if I reinstall everything with NEEDED entries for ld-linux.so.3.


Assuming that works, I'm not sure if this bug is worth tracking down any further.  If anyone wants to, I'm happy to provide any information they need, but if not feel free to close the bug.  (I'll reopen if recompiling things doesn't fix it.)  I won't have time to recompile everything until this weekend, so if you want more information try to ask before then.  (And it seems that I can duplicate the problem with new executables by using a copy of the old ld-linux.so.3, so I can give some help afterwards using that.)
Comment 9 SpanKY gentoo-dev 2013-04-08 03:40:52 UTC
(In reply to comment #8)

yes, what you describe sounds logical.  if you try to load the same ELF multiple times, things will probably crash.

things continue to work because the system installs a symlink from the old ldso name to the new ldso name in /lib/.

the only real fix is to rebuild everything.  this is a one time penalty and doesn't affect too many people.