Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 486618 - sys-libs/glibc-2.17 with >sys-devel/gcc-4.7 on HPPA - pkg_preinst(): segmentation fault in ./ld-*.so --library-path . /bin/date
Summary: sys-libs/glibc-2.17 with >sys-devel/gcc-4.7 on HPPA - pkg_preinst(): segmenta...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://sourceware.org/ml/libc-alpha/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-30 22:24 UTC by Jeroen Roovers (RETIRED)
Modified: 2014-07-25 09:13 UTC (History)
4 users (show)

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


Attachments
gdb backtrace with -O0 of build-default-hppa2.0-unknown-linux-gnu-nptl/elf/ld.so.1 --library-path . /bin/date (gdb-backtrace-O0.out.2,46.38 KB, text/plain)
2013-10-06 16:39 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 2013-09-30 22:24:31 UTC
# gdb ./ld-*.so
GNU gdb (Gentoo 7.6.1 p1) 7.6.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 "hppa2.0-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Really redefine built-in command "frame"? (y or n) [answered Y; input not from terminal]
Really redefine built-in command "thread"? (y or n) [answered Y; input not from terminal]
Really redefine built-in command "start"? (y or n) [answered Y; input not from terminal]
Reading symbols from /var/tmp/portage/sys-libs/glibc-2.17/image/lib/ld-2.17.so...(no debugging symbols found)...done.
gdb> run --library-path . /bin/date
Starting program: /var/tmp/portage/sys-libs/glibc-2.17/image/lib/./ld-2.17.so --library-path . /bin/date

Program received signal SIGSEGV, Segmentation fault.
_______________________________________________________________________________
     eax:Error while running hook_stop:
Value can't be converted to integer.
0x00000000 in ?? ()
gdb> t a a bt full
  Id   Target Id         Frame 
* 1    process 20081 "ld-2.17.so" 0x00000000 in ?? ()
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2013-09-30 22:31:48 UTC
Hm, even when adding the .debug files manually I can't get a proper backtrace:

gdb> symbol-file /usr/lib/debug/bin/date.debug 
Reading symbols from /usr/lib/debug/bin/date.debug...done.
gdb> t a a bt full
  Id   Target Id         Frame 
* 1    process 20336 "ld-2.17.so" 0x00000000 in ?? ()
gdb> symbol-file /var/tmp/portage/sys-libs/glibc-2.17/image/usr/lib/debug/lib/libc-2.17.so.debug
Reading symbols from /var/tmp/portage/sys-libs/glibc-2.17/image/usr/lib/debug/lib/libc-2.17.so.debug...done.
gdb> run --library-path . /bin/date
Starting program: /var/tmp/portage/sys-libs/glibc-2.17/image/lib/./ld-2.17.so --library-path . /bin/date

Program received signal SIGSEGV, Segmentation fault.
_______________________________________________________________________________
     eax:Error while running hook_stop:
Value can't be converted to integer.
0x00000000 in ?? ()
gdb> t a a bt full
  Id   Target Id         Frame 
* 1    process 20339 "ld-2.17.so" 0x00000000 in ?? ()
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2013-10-01 13:11:45 UTC
Same with the old gcc-4.6.3...
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2013-10-01 13:31:25 UTC
Tue  1 Oct 15:30:47 CEST 2013
emerge --info sys-libs/glibc
Portage 2.2.1 (default/linux/hppa/13.0, gcc-4.6.3, glibc-2.17, 3.10.7-gentoo-r1-JeR parisc64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.10.7-gentoo-r1-JeR-parisc64-PA8800_-Mako-with-gentoo-2.2
KiB Mem:     2049784 total,    583080 free
KiB Swap:    2101676 total,   2087808 free
Timestamp of tree: Tue, 01 Oct 2013 03:15:01 +0000
ld GNU ld (GNU Binutils) 2.23.1
distcc 3.1 hppa2.0-unknown-linux-gnu [enabled]
ccache version 3.1.9 [disabled]
app-shells/bash:          4.2_p45
dev-lang/python:          2.5.4-r6, 2.6.8-r3, 2.7.5-r2, 3.1.5-r1, 3.2.5-r2, 3.3.2-r2
dev-util/ccache:          3.1.9
dev-util/cmake:           2.8.10.2-r2
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.11.6, 1.12.6, 1.13.4
sys-devel/binutils:       2.22-r1, 2.23.1, 2.23.2
sys-devel/gcc:            4.6.3, 4.7.2-r1, 4.7.3-r1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo JeR
ACCEPT_KEYWORDS="hppa"
ACCEPT_LICENSE="*"
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/lib/python2.5/site-packages/buildbot/status/web /usr/lib/python2.6/site-packages/buildbot/status/web /usr/lib/python2.7/site-packages/buildbot/status/web /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /var/bind /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/apache2-php5.5/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/php/cli-php5.5/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 merge-sync metadata-transfer news notitles parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict test test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-mschedule=8000 -march=2.0 -ggdb -pipe -Wall -O2"
GENTOO_MIRRORS="ftp://ftp.snt.utwente.nl/gentoo ftp://gentoo.imj.fr/pub/gentoo/ ftp://mirror.netcologne.de/gentoo/ ftp://mirror.netcologne.de/gentoo/ ftp://91.121.124.139/gentoo-distfiles/"
LANG="en_GB.utf8"
LC_ALL="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
MAKEOPTS="-j6"
PKGDIR="/keeps/gentoo/packages/karsten"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/world/gentoo/portage"
PORTDIR_OVERLAY="/keeps/gentoo/local"
SYNC="rsync://rsync.nl.gentoo.org/gentoo-portage"
USE="256-color X acl alsa amr apng bash-completion bfio bittorrent bzip2 canberra cli coverage cracklib crypt cups custom-cflags cxx dbus dirac directfb distinct-l dri emacs exif expat fbcon filecaps firefox firmware foomaticdb fortran frontend-optional gdbm geoip glep gpm graphite gsm gstreamer gtk gudev guile hddtemp hppa hwdb iconv idn imlib ipv6 jingle jpeg kmod ladspa launch-frontend libcaca libcanberra libevent libusb libwww lua lzma lzo mad mng mod modplug modules mp3 mudflap multislot multitarget ncurses netlink nls nptl objc objc++ objc-gc offensive opengl openmp openrc oss pam pcre php pkcs11 png pnm python qt quvi readline regression-test rtmp samba schroedinger session smi speex spell sqlite ssl tcl tcpd test tga theora threads tk truetype unicode v4l vim-syntax vorbis vpx wcwidth x264 xattr xcb xft xhtml xml2 xvfb xvid zlib" ALSA_CARDS="ad1889 usb-audio" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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 author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CURL_SSL="nss" 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 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" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_5 python2_6 python2_7 python3_1 python3_2" RUBY_TARGETS="ruby18 ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="stifb 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"
USE_PYTHON="2.5 2.6 2.7 3.1 3.2"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================
USE="systemtap test -debug -gd (-hardened) (-multilib) -nscd -profile (-selinux) -suid -vanilla"

sys-libs/glibc-2.17 was built with the following:
CFLAGS="-mschedule=8000 -march=2.0 -ggdb -pipe -Wall -Wno-comment -O2 -fno-strict-aliasing"
CXXFLAGS="-mschedule=8000 -march=2.0 -ggdb -pipe -Wall -O2 -fno-strict-aliasing"
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2013-10-06 15:54:24 UTC
karsten /var/tmp/portage/sys-libs/glibc-2.17/work/glibc-2.17 # ../../image/lib/ld-2.17.so /bin/date
Sun  6 Oct 17:51:44 CEST 2013
Segmentation fault (core dumped)
karsten /var/tmp/portage/sys-libs/glibc-2.17/work/glibc-2.17 # gdb ../../image/lib/ld-2.17.so core
GNU gdb (Gentoo 7.6.1 p1) 7.6.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 "hppa2.0-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Really redefine built-in command "frame"? (y or n) [answered Y; input not from terminal]
Really redefine built-in command "thread"? (y or n) [answered Y; input not from terminal]
Really redefine built-in command "start"? (y or n) [answered Y; input not from terminal]
Reading symbols from /var/tmp/portage/sys-libs/glibc-2.17/image/lib/ld-2.17.so...(no debugging symbols found)...done.
BFD: Warning: /var/tmp/portage/sys-libs/glibc-2.17/work/glibc-2.17/core is truncated: expected core file size >= 1814528, found: 1687552.
[New LWP 18682]
Core was generated by `../../image/lib/ld-2.17.so /bin/date'.
Program terminated with signal 11, Segmentation fault.
#0  0x00000000 in ?? ()
gdb> bt full
#0  0x00000000 in ?? ()
No symbol table info available.
#1  0x4110c03c in _dl_fini () from ../../image/lib/ld-2.17.so
No symbol table info available.
#2  0x407eae1c in __run_exit_handlers (status=0x0, listp=0x409101b0 <__exit_funcs>, run_list_atexit=0x1) at exit.c:77
        atfct = <optimized out>
        onfct = <optimized out>
        cxafct = <optimized out>
        f = <optimized out>
#3  0x407eaeb4 in __GI_exit (status=<optimized out>) at exit.c:99
No locals.
#4  0x000119e4 in ?? ()
No symbol table info available.
#5  0x000119e4 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2013-10-06 16:07:16 UTC
do_page_fault() pid=18682 command='ld-2.17.so' type=6 address=0x00000003
CPU: 0 PID: 18682 Comm: ld-2.17.so Not tainted 3.10.7-gentoo-r1-JeR #2
task: 0000000074a8afd0 ti: 0000004089728000 task.ti: 0000004089728000

     YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
PSW: 00000000000001001111111100001111 Not tainted
r00-03  000000ff0004ff0f 00000000fb1da540 000000004110c03f 00000000fb1da540
r04-07  000000004111f3e0 0000000041120918 0000000000000000 0000000000000003
r08-11  00000000fb1da5d0 000000004111fbe0 0000000000000000 0000000000000002
r12-15  00000000fb1da54a 000000004111fc94 0000000000000000 000000004111fc90
r16-19  00000000411203a0 000000000001bdf8 00000000000bc0f8 0000000000000000
r20-23  000000000001ab3c 00000000fb1da696 0000000000000001 0000000000000000
r24-27  0000000000000002 0000000000000000 00000000411203a0 000000000001e0dc
r28-31  000000000001ab3c 0000000000000001 00000000fb1da640 000000004110c03f
sr00-03  0000000009bb7000 0000000009bb7000 0000000000000000 0000000009bb7000
sr04-07  0000000009bb7000 0000000009bb7000 0000000009bb7000 0000000009bb7000

     VZOUICununcqcqcqcqcqcrmunTDVZOUI
FPSR: 00000000000000000000000000000000
FPER1: 00000000
fr00-03  0000000000000000 0000000000000000 0000000000000000 0000000000000000
fr04-07  41d492e128828f5c 0000000000000000 0000000000000000 4090000000000000
fr08-11  0000000000000000 0000000000000000 0000000000000000 0000000000000000
fr12-15  41d492e128828f5c 0000000000000000 0000000000000000 0000000000000000
fr16-19  0000000000000000 0000000000000000 0000000000000000 0000000000000000
fr20-23  0000000000000000 0000000000000000 0000000000000004 0000000200000000
fr24-27  0000000000000000 3fe0000000000000 412e848000000000 0000000000000000
fr28-31  0000000000000000 0000000000000000 0000000000000000 0000000000000000

IASQ: 0000000009bb7000 0000000009bb7000 IAOQ: 0000000000000003 0000000000000007
 IIR: 43ffff80    ISR: 0000000009bb7000  IOR: 0000000040005000
 CPU:        0   CR30: 0000004089728000 CR31: ffffffffffffffff
 ORIG_R28: 0000000000000000
 IAOQ[0]: 0000000000000003
 IAOQ[1]: 0000000000000007
 RP(r2): 000000004110c03f
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2013-10-06 16:39:57 UTC
Created attachment 360246 [details]
gdb backtrace with -O0 of build-default-hppa2.0-unknown-linux-gnu-nptl/elf/ld.so.1 --library-path . /bin/date
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2013-10-15 16:11:46 UTC
(In reply to Jeroen Roovers from comment #2)
> Same with the old gcc-4.6.3...

No, wrong. With 4.6.3 it works fine. This is about 4.7.3-r1 and perhaps 4.7.*.
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2013-10-16 02:56:15 UTC
Same with gcc-4.8.1.
Comment 9 Benda Xu gentoo-dev 2013-10-16 03:54:51 UTC
cannot reproduce it with gcc-4.7.3 and glibc-2.17 on amd64, x86 or arm. Probably it is hppa only.
Comment 10 Jeroen Roovers (RETIRED) gentoo-dev 2013-10-16 12:59:15 UTC
(In reply to Benda Xu from comment #9)
> Probably it is hppa only.

Of course it is.
Comment 11 Guy Martin (RETIRED) gentoo-dev 2013-10-17 12:56:15 UTC
I've found the issue. The problem is in the macro DL_AUTO_FUNCTION_ADDRESS() in ports/sysdeps/hppa/dl-lookupcfg.h.

The macro declares unsigned int fptr[2] in it's own scope (between the {}). This means that after the macro completes, the value inside fptr[] is not guaranteed to be valid.
It seems that the newest version of gcc (>=4.7) optimize this and thus init isn't valid anymore when called.


Replacing DL_AUTO_FUNCTION_ADDRESS() with DL_STATIC_FUNCTION_ADDRESS() solves the problem as fptr[] is declared static. However I'm not sure it's the right approach despite the code will not break.


I'll issue a patch upstream ASAP.
Comment 12 Guy Martin (RETIRED) gentoo-dev 2013-10-17 13:15:50 UTC
From the source code, this will affect ia64 as well as they use the same macro.
Comment 13 SpanKY gentoo-dev 2013-10-19 05:54:22 UTC
yeah, ia64 has started failing w/gcc-4.7