Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 546986 - sys-libs/glibc: hypot() on ppc64 hits SIGILL in libm.so with xxlxor usage
Summary: sys-libs/glibc: hypot() on ppc64 hits SIGILL in libm.so with xxlxor usage
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC64 Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://sourceware.org/bugzilla/show_...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-18 09:38 UTC by Pacho Ramos
Modified: 2017-02-23 03:43 UTC (History)
3 users (show)

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


Attachments
build.log (a089fcc677e5.txt,132.76 KB, text/plain)
2015-04-18 09:38 UTC, Pacho Ramos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2015-04-18 09:38:57 UTC
Created attachment 401544 [details]
build.log

I get:
Sat Apr 18 09:30:12  2015 ***
GROFF_COMMAND_PREFIX= GROFF_BIN_PATH="`echo /var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/src/roff/groff /var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/src/roff/troff /var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/src/preproc/eqn /var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/src/preproc/pic /var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/src/preproc/tbl /var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/src/devices/grops | sed -e 's|  *|:|g'`" /var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/src/roff/groff/groff -F/var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/font -F/var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/font -M/var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/tmac -M/var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/tmac -M. -t -p -e -U -Tps -dfontpath=/var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/font -dsopath=./ \
         -mhdtbl examples/mixed_pickles.roff >examples/mixed_pickles.ps
/var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/src/roff/groff/groff: pic: Signal 4
Makefile.sub:95: recipe for target 'examples/mixed_pickles.ps' failed
make[2]: *** [examples/mixed_pickles.ps] Error 2
make[2]: Leaving directory '/var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3/contrib/hdtbl'
Makefile:902: recipe for target 'contrib/hdtbl' failed
make[1]: *** [contrib/hdtbl] Error 2
make[1]: Leaving directory '/var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3'
Makefile:801: recipe for target 'all' failed
make: *** [all] Error 2
 * ERROR: sys-apps/groff-1.22.3::gentoo failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-apps/groff-1.22.3::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-apps/groff-1.22.3::gentoo'`.
 * The complete build log is located at '/var/log/portage/build/sys-apps/groff-1.22.3:20150418-092912.log'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/sys-apps/groff-1.22.3/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-apps/groff-1.22.3/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3'
 * S: '/var/tmp/portage/sys-apps/groff-1.22.3/work/groff-1.22.3'
Comment 1 Pacho Ramos gentoo-dev 2015-04-18 09:39:09 UTC
# emerge --info
Portage 2.2.18 (python 2.7.9-final-0, default/linux/powerpc/ppc64/13.0/64bit-userland/desktop/gnome/systemd, gcc-4.8.4, glibc-2.19-r1, 3.12.20-gentoo ppc64)
=================================================================
System uname: Linux-3.12.20-gentoo-ppc64-POWER7_-architected-with-gentoo-2.2
KiB Mem:    16514732 total,   6863976 free
KiB Swap:    7814548 total,   7800272 free
Timestamp of repository gentoo: Sat, 18 Apr 2015 06:00:01 +0000
sh bash 4.2_p53
ld GNU ld (Gentoo 2.24 p1.4) 2.24
ccache version 3.1.9 [enabled]
app-shells/bash:          4.2_p53::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.9-r1::gentoo, 3.4.1::gentoo
dev-util/ccache:          3.1.9-r4::gentoo
dev-util/cmake:           2.8.12.2-r1::gentoo
dev-util/pkgconfig:       0.28-r1::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.13.11::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.12.6::gentoo, 1.13.4::gentoo
sys-devel/binutils:       2.24-r3::gentoo
sys-devel/gcc:            4.8.4::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)
sys-libs/glibc:           2.19-r1::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

ACCEPT_KEYWORDS="ppc64"
ACCEPT_LICENSE="*"
CBUILD="powerpc64-unknown-linux-gnu"
CFLAGS="-O2 -pipe -fno-stack-protector"
CHOST="powerpc64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -fno-stack-protector"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build=n --autounmask-write --keep-going"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms split-log strict test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j33"
PKGDIR="/usr/portage/packages"
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"
USE="X a52 aac acl alsa berkdb bluetooth branding bzip2 cairo cdda cdr cli colord cracklib crypt cups cxx dbus dri dts dvd dvdr eds emboss encode evo exif fam firefox flac fortran gdbm gif glamor gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk ibm iconv introspection ipv6 jpeg lcms ldap libnotify libsecret mad mng modules mp3 mp4 mpeg nautilus ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppc64 ppds pulseaudio qt3support qt4 readline sdl session socialweb spell ssl startup-notification svg systemd tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xcb xml xv xvid zlib" ABI_PPC="64" 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" 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 ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_US" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="fbdev mach64 mga nv r128 radeon 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, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 2 SpanKY gentoo-dev 2015-04-18 20:45:50 UTC
> groff: pic: Signal 4

that's SIGILL.  please check `dmesg` to see if it matches.

i just built groff-1.22.3 in my ppc64 chroot w/gcc-4.8.4 and it finished OK ...
Comment 3 Pacho Ramos gentoo-dev 2015-04-18 20:55:54 UTC
I see this in dmesg:
[10102064.411315] pic[31908]: unhandled signal 4 at 00003fff959bbbb4 nip 00003fff959bbbb4 lr 00003fff959bbb94 code 30001
[10102064.491543] pic[32091]: unhandled signal 4 at 00003fffa3fbbbb4 nip 00003fffa3fbbbb4 lr 00003fffa3fbbb94 code 30001
[10102064.495326] grn[32072]: unhandled signal 4 at 00003fff9a93bbb4 nip 00003fff9a93bbb4 lr 00003fff9a93bb94 code 30001

This is timberdoodle.gentoo.osuosl.org machine
Comment 4 SpanKY gentoo-dev 2015-04-18 22:23:53 UTC
(In reply to Pacho Ramos from comment #3)

i'm using the same system ;)

this a clean build from a stage3 ?  i.e. easy to reproduce ?
Comment 5 Pacho Ramos gentoo-dev 2015-04-19 07:02:43 UTC
Well... it's a stage3 with some other installed packages that have been accumulated since I started working with it some weeks ago. Anyway, it's completely reproducible for me :/
Comment 6 SpanKY gentoo-dev 2016-03-17 21:07:39 UTC
looks like the crash is coming from libm.  the hypot func is using the xxlxor insn and crashing on that.  googling suggests that xxlxor is part of POWER7's VSX and that's what timberdoodle is running, so i have no idea why it's failing.  i'll post to the glibc lists about the issue to see if they know.

simple test case:

$ cat test.c
#include <math.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
    double x = atoi(argv[1]), y = atoi(argv[2]);
    return hypot(x, y);
}

$ gcc test.c -g -O2 -lm

$ ./a.out 4 0
Illegal instruction (core dumped)

$ gdb ./a.out core
Reading symbols from ./a.out...done.
Core was generated by `./a.out 4 0 '.
Program terminated with signal SIGILL, Illegal instruction.
#0  __ieee754_hypot_power7 (x=4, y=0) at ../sysdeps/powerpc/fpu/e_hypot.c:92
92        if (y == 0.0)
(gdb) bt
#0  __ieee754_hypot_power7 (x=4, y=0) at ../sysdeps/powerpc/fpu/e_hypot.c:92
#1  0x00003fff9ef0c754 in __hypot (x=<optimized out>, y=<optimized out>) at ../math/w_hypot.c:24
#2  0x0000000010000554 in main (argc=<optimized out>, argv=0x3ffff974ac18) at test.c:6
(gdb) disassemble
...
=> 0x00003fff9ef55404 <+132>:   xxlxor  vs0,vs0,vs0
...
Comment 7 Anthony Basile gentoo-dev 2016-03-18 00:14:21 UTC
(In reply to SpanKY from comment #6)
> ...
> => 0x00003fff9ef55404 <+132>:   xxlxor  vs0,vs0,vs0
> ...

someone on the glibc lists might know, but it looks like the instruction is just not there in the cpu's isa:

ppc64-64ul timberdoodle ~ # cat test.c 
int main() {
    double x = 0.0;
    __asm__("xxlxor %0, %0, %0" : "=r"(x));
}
ppc64-64ul timberdoodle ~ # gcc test.c 
ppc64-64ul timberdoodle ~ # ./a.out 
Illegal instruction (core dumped)
Comment 8 SpanKY gentoo-dev 2016-03-18 00:57:50 UTC
(In reply to Anthony Basile from comment #7)

wikipedia implies POWER7 should include VSX:
https://en.wikipedia.org/wiki/AltiVec#VSX.28Vector_Scalar_Extension.29

but i'm just going to wait for the glibc/ppc guys to respond.
Comment 9 SpanKY gentoo-dev 2016-03-19 01:56:27 UTC
(In reply to Anthony Basile from comment #7)

upstream suggested the kernel might be at fault.  we're using a 2 year old kernel at this point.  can you see about upgrading the kernel on timberdoodle ?
Comment 10 Anthony Basile gentoo-dev 2016-03-19 13:06:46 UTC
(In reply to SpanKY from comment #9)
> (In reply to Anthony Basile from comment #7)
> 
> upstream suggested the kernel might be at fault.  we're using a 2 year old
> kernel at this point.  can you see about upgrading the kernel on
> timberdoodle ?

yeah i saw the reply that VSX is initially disabled to optimize context switching.  there has been some recent work on this last Dec by Blanchard:

https://git.kernel.org/cgit/linux/kernel/git/powerpc/linux.git/log/?qt=grep&q=VSX

it might be worth trying kernels after those commits since 07e45c12 removes the disabling of the kernel's FP/VMX/VSX MSR bits on a context switch.

i'm willing to get a new kernel going on timberdoodle, but i really need someone on site in case something goes wrong so we can fall back to the current kernel.  robbat2 once told me the contact name at osuosl for timberdoodle, but i forgot, so i'm cc-ing him.
Comment 11 SpanKY gentoo-dev 2016-04-07 18:09:15 UTC
i've e-mailed OSU support as Robin said he didn't remember
Comment 12 Jack Morgan (RETIRED) gentoo-dev 2016-04-10 00:00:49 UTC
Lance (aka Ramereth) is the Oregon State Open Source Lab (OSUOSL). YOu can also ask for hep in #osuosl channel
Comment 13 SpanKY gentoo-dev 2017-02-23 03:43:02 UTC
issue was with the kernel being too old.  we've upgraded now to 4.9.6 and the crash has gone away.