Bug 66368 - [5 Regression] go tool crashes on powerpc-linux-gnu
Summary: [5 Regression] go tool crashes on powerpc-linux-gnu
Status: WAITING
Alias: None
Product: gcc
Classification: Unclassified
Component: go (show other bugs)
Version: 5.0
: P4 normal
Target Milestone: 6.5
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-01 21:27 UTC by Matthias Klose
Modified: 2017-11-03 12:28 UTC (History)
7 users (show)

See Also:
Host:
Target: powerpc-linux-gnu
Build:
Known to work: 5.0
Known to fail: 5.1.0
Last reconfirmed: 2016-02-10 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2015-06-01 21:27:03 UTC
"go version" on powerpc-linux-gnu works with the 5.1 release candidate, but crashes with the 5.1.0 release, and the current branch.

reverting the changes made in PR65787 fixes the issue. Seen on Ubuntu 15.04 and 15.10 systems, however I can't reproduce this in Debian unstable. Same binutils version, Debian has glibc-2.19, Ubuntu glibc-2.21.  It looks like I can't reproduce this with a GCC trunk build on either platform. So I'm a bit lost ...

$ go version
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x3]

goroutine 16 [running]:
runtime_dopanic
        ../../../src/libgo/runtime/panic.c:131
runtime_throw
        ../../../src/libgo/runtime/panic.c:193
sig_panic_leadin
        ../../../src/libgo/runtime/go-signal.c:247
sig_panic_info_handler
        ../../../src/libgo/runtime/go-signal.c:281

        :0
__go_go
        ../../../src/libgo/runtime/proc.c:2328
runtime_main
        ../../../src/libgo/runtime/proc.c:598

goroutine 0 [idle]:
panic during panic

goroutine 0 [idle]:
runtime_dopanic
        ../../../src/libgo/runtime/panic.c:131
runtime_startpanic
        ../../../src/libgo/runtime/panic.c:100
runtime_throw
        ../../../src/libgo/runtime/panic.c:191
runtime_gogo
        ../../../src/libgo/runtime/proc.c:251
runtime_tracebackothers
        ../../../src/libgo/runtime/proc.c:767
runtime_dopanic
        ../../../src/libgo/runtime/panic.c:139
runtime_throw
        ../../../src/libgo/runtime/panic.c:193
sig_panic_leadin
        ../../../src/libgo/runtime/go-signal.c:247
sig_panic_info_handler
        ../../../src/libgo/runtime/go-signal.c:281

        :0
__go_go
        ../../../src/libgo/runtime/proc.c:2328
runtime_main
        ../../../src/libgo/runtime/proc.c:598
Comment 1 Matthias Klose 2015-06-01 23:00:29 UTC
correction: reverting the changes from PR65787 only helps for the 5.1.0 release, not the gcc-5-branch.
Comment 2 Matthias Klose 2015-06-02 16:28:35 UTC
maybe the changes from PR65787 are unrelated.

Building a compiler which has -fstack-protector strong enabled by default. The crash goes away when I add -fno-stack-protector to AM_CFLAGS in libgo.  So it should be reproducible by adding -fstack-protector strong to AM_CFLAGS in libgo.

Don't know why this shows up only now, and on powerpc-linux-gnu only.
Comment 3 boger 2015-06-02 17:11:39 UTC
Let's get the obvious set up questions out of the way first...

If you are building on Ubuntu, I assume you must be trying to build powerpc64le-linux-gnu, and not powerpc-linux-gnu.

Is your LD_LIBRARY_PATH being set to the correct path for the libgo that corresponds to the go and gccgo you are using?  That is, you aren't using libgo from a gcc trunk build but go and gccgo from a gcc5 build?
Comment 4 Adam Conrad 2015-06-02 20:44:22 UTC
No, this is specifically about powerpc-linux-gnu.  powerpc64le works fine.

As for the library path questions, this first came up in runtime bug reports, and has been confirmed by many on clean chroots, so no, there aren't random libraries kicking around from other builds.

doko's stack-protector discovery makes perfect sense as to why this works fine on Debian but not Ubuntu, as that's really the only difference between our two toolchains.  Now, the question is *why*, and why only on ppc32?  (Or maybe only on big-endian PPC, neither of us has tested a powerpc64-linux-gnu build yet).
Comment 5 Matthias Klose 2015-06-02 22:37:21 UTC
building trunk libgo with -fstack-protector-strong yields:

$ go version
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x3]

goroutine 16 [running]:

        :0

        :0

        :0

        :0
[...]

building libgo and libbacktrace with -fstack-protector-strong yields:

fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x3]

goroutine 16 [running]:
runtime_dopanic
        ../../../src/libgo/runtime/panic.c:131
runtime_throw
        ../../../src/libgo/runtime/panic.c:193
sig_panic_leadin
        ../../../src/libgo/runtime/go-signal.c:247
sig_panic_info_handler
        ../../../src/libgo/runtime/go-signal.c:281

        :0
__go_go
        ../../../src/libgo/runtime/proc.c:2328
runtime_main
        ../../../src/libgo/runtime/proc.c:598

goroutine 0 [idle]:
panic during panic
goroutine 0 [idle]:
runtime_dopanic
        ../../../src/libgo/runtime/panic.c:131
runtime_startpanic
        ../../../src/libgo/runtime/panic.c:100
runtime_throw
        ../../../src/libgo/runtime/panic.c:191
runtime_gogo
        ../../../src/libgo/runtime/proc.c:251
runtime_tracebackothers
        ../../../src/libgo/runtime/proc.c:767
runtime_dopanic
        ../../../src/libgo/runtime/panic.c:139
runtime_throw
        ../../../src/libgo/runtime/panic.c:193
sig_panic_leadin
        ../../../src/libgo/runtime/go-signal.c:247
sig_panic_info_handler
        ../../../src/libgo/runtime/go-signal.c:281

        :0
__go_go
        ../../../src/libgo/runtime/proc.c:2328
runtime_main
        ../../../src/libgo/runtime/proc.c:598
Comment 6 boger 2015-06-03 13:08:13 UTC
I think you've said the problem only occurs when using -fstack-protector-strong and when building with glibc-2.21.

Have you tried using gdb to see where the segv actually occurs?

>gdb go
.....


>run version
(Once it hits the segv)
>x/20ni $pc-24
>bt

The panic stacktrace is showing a line in proc.c:2328 which is making a call to __builtin_return_address according to my source.  Does that match your source?

If that is the case then I have a feeling this isn't go specific, but a problem with calling __builtin_return_address on ppc32 when using -fstack-protector-strong and possibly glibc-2.21 has some affect.
Comment 7 Bill Schmidt 2015-06-04 03:26:09 UTC
FYI, PR65787 only changes behavior for powerpc64le, so it's odd that you would see any differences with or without those changes.  The two patched routines are never called for big endian.
Comment 8 Richard Biener 2015-07-16 09:11:36 UTC
GCC 5.2 is being released, adjusting target milestone to 5.3.
Comment 9 Ian Lance Taylor 2015-11-23 04:12:24 UTC
I'm not having any luck reproducing this.  I built a 32-bit PPC GNU/Linux (on the GCC compile farm, which is a PPC64 machine, using glibc 2.18).  I deleted the libgo files and rebuilt them with -fstack-protector-strong.  I built a new go tool.  It seems to work fine.

Let's try this: if you can still recreate this problem, send me the crashing binary.  Maybe I can see something there.
Comment 10 Richard Biener 2015-12-04 10:43:55 UTC
GCC 5.3 is being released, adjusting target milestone.
Comment 11 Richard Biener 2016-06-03 10:04:35 UTC
GCC 5.4 is being released, adjusting target milestone.