Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: some cgo tests are failing on freebsd/arm64 #35197

Closed
dmgk opened this issue Oct 27, 2019 · 4 comments
Closed

runtime: some cgo tests are failing on freebsd/arm64 #35197

dmgk opened this issue Oct 27, 2019 · 4 comments

Comments

@dmgk
Copy link
Member

dmgk commented Oct 27, 2019

There still seem to be some issues with cgo, see https://golang.org/cl/199919:

--- FAIL: TestSigStackSwapping (12.99s)
    crash_test.go:95: testprogcgo SigStack exit status: signal: segmentation fault (core dumped)
    crash_cgo_test.go:480: expected "OK\n" got 
--- FAIL: TestCgoNumGoroutine (12.93s)
    crash_test.go:95: testprogcgo NumGoroutine exit status: signal: segmentation fault (core dumped)
    crash_cgo_test.go:411: expected "OK\n" got 
--- FAIL: TestEnsureDropM (21.49s)
    crash_test.go:95: testprogcgo EnsureDropM exit status: signal: segmentation fault (core dumped)
    crash_cgo_test.go:174: expected "OK\n", got 
--- FAIL: TestCgoExternalThreadSignal (26.27s)
    crash_cgo_test.go:129: exit status: signal: segmentation fault (core dumped)
--- FAIL: TestCgoExternalThreadPanic (11.53s)
    crash_test.go:95: testprogcgo CgoExternalThreadPanic exit status: signal: segmentation fault (core dumped)
    crash_cgo_test.go:82: want failure containing "panic: BOOM". output:
        
--- FAIL: TestCgoExternalThreadSIGPROF (26.92s)
    crash_cgo_test.go:106: exit status: signal: segmentation fault (core dumped)
--- FAIL: TestCgoCallbackGC (12.73s)
    crash_test.go:95: testprogcgo CgoCallbackGC exit status: signal: segmentation fault (core dumped)
    crash_cgo_test.go:70: expected "OK\n", but got:
FAIL
FAIL	runtime	101.212s
FAIL

Not sure whether these are the same as the cgo issues @dmgk and @MikaelUrankar saw. Or maybe these are some changes I forgot to pick up during rebase of https://golang.org/cl/198544.

Originally posted by @tklauser in #24715 (comment)

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/203519 mentions this issue: cmd/link: switch to ld.bfd on freebsd/arm64

@dmgk
Copy link
Member Author

dmgk commented Oct 27, 2019

This appears to be is an issue with LLD 8.0.1 (FreeBSD 366581-1200008) on FreeBSD aarch64.

Stacktrace from failing NumGoroutine test in src/runtime/testdata/testprogcgo:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000000000033ded8 in runtime.adjustSignalStack (sig=<optimized out>, mp=0x0, gsigStack=0xffffbf7f98c8, ~r3=<optimized out>)
    at /home/builder/goroot/src/runtime/signal_unix.go:374
374             if sp >= mp.gsignal.stack.lo && sp < mp.gsignal.stack.hi {
[Current thread is 1 (LWP 101003)]
Breakpoint 1 at 0x3568fc: file /home/builder/goroot/src/runtime/tls_arm64.s, line 13.
Breakpoint 2 at 0x3558d8: file /home/builder/goroot/src/runtime/asm_arm64.s, line 995.
Loading Go Runtime support.
(gdb) bt
#0  0x000000000033ded8 in runtime.adjustSignalStack (sig=<optimized out>, mp=0x0, gsigStack=0xffffbf7f98c8, ~r3=<optimized out>)
    at /home/builder/goroot/src/runtime/signal_unix.go:374
#1  0x000000000033ddf0 in runtime.sigtrampgo (sig=11, info=0xffffbf7f99e0, ctx=0xffffbf7f9a30)
    at /home/builder/goroot/src/runtime/signal_unix.go:347
#2  0x0000000000356650 in runtime.sigtramp () at /home/builder/goroot/src/runtime/sys_freebsd_arm64.s:323
#3  <signal handler called>
#4  runtime.cgocallback_gofunc () at /home/builder/goroot/src/runtime/asm_arm64.s:1039
#5  0x00000000003558b0 in runtime.cgocallback () at /home/builder/goroot/src/runtime/asm_arm64.s:983
#6  0x00000000003ae538 in _cgoexp_690828bc0c24_CallbackNumGoroutine (a=0xffffbf7f9f87, n=0, ctxt=0) at _cgo_gotypes.go:432
#7  0x0000000000397adc in crosscall2 () at /home/builder/goroot/src/runtime/cgo/asm_arm64.s:47
#8  0x0000000000000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

I (sort of) narrowed the issue down to https://github.com/golang/go/blob/master/src/runtime/tls_arm64.s#L11 - when linked with ld.lld, g gets loaded with a wrong value.

/cc @MikaelUrankar @tklauser

gopherbot pushed a commit that referenced this issue Oct 28, 2019
Updates #35197

Change-Id: I4fd85c84475761d71d2c17e62796e0a411cf91d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/203519
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/199919 mentions this issue: cmd/nm, runtime/cgo: add cgo support for freebsd/arm64

gopherbot pushed a commit that referenced this issue Oct 28, 2019
Based on work by Mikaël Urankar (@MikaelUrankar).

Updates #24715
Updates #35197

Change-Id: I91144101043d67d3f8444bf8389c9606abe2a66c
Reviewed-on: https://go-review.googlesource.com/c/go/+/199919
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@tklauser
Copy link
Member

Seems to be fixed by https://golang.org/cl/203519

@golang golang locked and limited conversation to collaborators Oct 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants