go: runtime: crashes on linux/riscv64 during runtime/pprof and os/signal tests

What version of Go are you using (go version)?

$ go version
go version go1.17.3 darwin/amd64

(Cross-compiling to linux/riscv64)

Does this issue reproduce with the latest release?

Yes, this problem appears with go1.17.3, the latest stable release.

What operating system and processor architecture are you using (go env)?

I only have a working Go installation on my darwin/amd64 machine (below). I’m cross-compiling from there to linux/riscv64, where I see the problem.

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/rhysh/Library/Caches/go-build"
GOENV="/Users/rhysh/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/rhysh/work/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/rhysh/work"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/pw/d_qmtcrd3vs0890gvmrq8qx80000gn/T/go-build338083123=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I’ve got a small RISCV64 computer: Nezha with the Allwinner D1 SOC. I’m running the runtime/pprof tests at version go1.17.3 and seeing several types of “fatal error” failures.

$ GOOS=linux GOARCH=riscv64 go test -c -o /tmp/pprof.go1.17.3.test runtime/pprof
$ GOOS=linux GOARCH=riscv64 go build -o /tmp/stress golang.org/x/tools/cmd/stress
$ go version /tmp/pprof.go1.17.3.test 
/tmp/pprof.go1.17.3.test: go1.17.3
$ # scp and ssh to the linux/riscv64 host

sipeed@sipeed:~$ uname -a
Linux sipeed 5.4.61 #15 PREEMPT Thu Jun 10 06:50:03 UTC 2021 riscv64 GNU/Linux
sipeed@sipeed:~$ nohup ./stress ./pprof.go1.17.3.test -test.run=TestCPUProfileMultithreaded -test.short=true &

What did you expect to see?

Near-zero failure rate of runtime/pprof’s TestCPUProfileMultithreaded test in short mode when using go1.17.3, and zero crashes.

What did you see instead?

Currently about 1.5% failure rate, all of which are crashes (“fatal error”). (On the plus side, I haven’t seen any test failures for that test.)

In the last 42 minutes, the stress run has collected:

  • 22 crashes with “fatal error: unexpected signal during runtime execution” (Most with pc and addr of 0x0, some with pc and addr of 0x2, some with 0x80.)
  • 7 crashes with “fatal error: unknown caller pc”
  • 7 crashes with “fatal error: runtime: split stack overflow”

Here’s an example of each:

"fatal error: unexpected signal during runtime execution" / "[signal SIGSEGV: segmentation violation code=0x1 addr=0x2 pc=0x2]"
sipeed@sipeed:~$ cat /tmp/go-stress-20211121T161735-4177513427
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x2 pc=0x2]

goroutine 0 [idle]:
runtime: unexpected return pc for runtime.sigpanic called from 0x2
stack: frame={sp:0x3fb005b730, fp:0x3fb005b760} stack=[0x3fb0054000,0x3fb005c000)
0x0000003fb005b630:  0x0000000000000000  0x000000000004cb6c <runtime.fatalthrow.func1+0x000000000000005c> 
0x0000003fb005b640:  0x000000000004c8c0 <runtime.throw+0x0000000000000060>  0x0000003fb005b708 
0x0000003fb005b650:  0x0000000000000000  0x0000003fb0000ea0 
0x0000003fb005b660:  0x010000000004cea4  0x0000000000000004 
0x0000003fb005b670:  0x000000000000001f  0x0000000000000002 
0x0000003fb005b680:  0x0000000000000002  0x0000000000000001 
0x0000003fb005b690:  0x00000000001ae451  0x000000000004cafc <runtime.fatalthrow+0x000000000000004c> 
0x0000003fb005b6a0:  0x0000003fb0000ea0  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b6b0:  0x0000003fb005b708  0x000000000004e4d8 <runtime.printunlock+0x0000000000000058> 
0x0000003fb005b6c0:  0x0000003fb005b708  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b6d0:  0x0000003fb0000ea0  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b6e0:  0x0000003fb005b6e8  0x000000000004cb10 <runtime.fatalthrow.func1+0x0000000000000000> 
0x0000003fb005b6f0:  0x0000003fb0000ea0  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b700:  0x0000003fb005b708  0x0000000000066a3c <runtime.sigpanic+0x000000000000029c> 
0x0000003fb005b710:  0x0000003fb005b718  0x000000000004c8d8 <runtime.throw.func1+0x0000000000000000> 
0x0000003fb005b720:  0x00000000001b170e  0x000000000000002a 
0x0000003fb005b730: <0x0000000000000002  0x00000000001b170e 
0x0000003fb005b740:  0x000000000000002a  0x0000000000000080 
0x0000003fb005b750:  0x0000000000000003  0x0000000000000000 
0x0000003fb005b760: >0x0000000000000003  0x00000000000658a4 <runtime.doSigPreempt+0x00000000000000bc> 
0x0000003fb005b770:  0x0000000000158554 <runtime/pprof.cpuHog1+0x0000000000000014>  0x00000000002a7328 
0x0000003fb005b780:  0x00000000002b6f80  0x0000000000000000 
0x0000003fb005b790:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7a0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7b0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7c0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7d0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7e0:  0x0000000000065ef8 <runtime.sighandler+0x0000000000000118>  0x0000003fb00ba820 
0x0000003fb005b7f0:  0x0000000000158554 <runtime/pprof.cpuHog1+0x0000000000000014>  0x0000003fb002ef58 
0x0000003fb005b800:  0x00000000001584d4 <runtime/pprof.cpuHogger+0x000000000000005c>  0x0000000000065f98 <runtime.sighandler+0x00000000000001b8> 
0x0000003fb005b810:  0x000000000006605c <runtime.sighandler+0x000000000000027c>  0x0000000000280638 
0x0000003fb005b820:  0x00000000002b6f80  0x0000000000065ad4 <runtime.sigtrampgo+0x000000000000019c> 
0x0000003fb005b830:  0x0000003fb00ba820  0x0000003fb005b8c8 
0x0000003fb005b840:  0x00000000001584d4 <runtime/pprof.cpuHogger+0x000000000000005c>  0x0000003fb00ba820 
0x0000003fb005b850:  0x0000003fb0030800  0x0000000000000000 
runtime.throw({0x1b170e, 0x2a})
	/usr/local/go/src/runtime/panic.go:1198 +0x60
runtime: unexpected return pc for runtime.sigpanic called from 0x2
stack: frame={sp:0x3fb005b730, fp:0x3fb005b760} stack=[0x3fb0054000,0x3fb005c000)
0x0000003fb005b630:  0x0000000000000000  0x000000000004cb6c <runtime.fatalthrow.func1+0x000000000000005c> 
0x0000003fb005b640:  0x000000000004c8c0 <runtime.throw+0x0000000000000060>  0x0000003fb005b708 
0x0000003fb005b650:  0x0000000000000000  0x0000003fb0000ea0 
0x0000003fb005b660:  0x010000000004cea4  0x0000000000000004 
0x0000003fb005b670:  0x000000000000001f  0x0000000000000002 
0x0000003fb005b680:  0x0000000000000002  0x0000000000000001 
0x0000003fb005b690:  0x00000000001ae451  0x000000000004cafc <runtime.fatalthrow+0x000000000000004c> 
0x0000003fb005b6a0:  0x0000003fb0000ea0  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b6b0:  0x0000003fb005b708  0x000000000004e4d8 <runtime.printunlock+0x0000000000000058> 
0x0000003fb005b6c0:  0x0000003fb005b708  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b6d0:  0x0000003fb0000ea0  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b6e0:  0x0000003fb005b6e8  0x000000000004cb10 <runtime.fatalthrow.func1+0x0000000000000000> 
0x0000003fb005b6f0:  0x0000003fb0000ea0  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b700:  0x0000003fb005b708  0x0000000000066a3c <runtime.sigpanic+0x000000000000029c> 
0x0000003fb005b710:  0x0000003fb005b718  0x000000000004c8d8 <runtime.throw.func1+0x0000000000000000> 
0x0000003fb005b720:  0x00000000001b170e  0x000000000000002a 
0x0000003fb005b730: <0x0000000000000002  0x00000000001b170e 
0x0000003fb005b740:  0x000000000000002a  0x0000000000000080 
0x0000003fb005b750:  0x0000000000000003  0x0000000000000000 
0x0000003fb005b760: >0x0000000000000003  0x00000000000658a4 <runtime.doSigPreempt+0x00000000000000bc> 
0x0000003fb005b770:  0x0000000000158554 <runtime/pprof.cpuHog1+0x0000000000000014>  0x00000000002a7328 
0x0000003fb005b780:  0x00000000002b6f80  0x0000000000000000 
0x0000003fb005b790:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7a0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7b0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7c0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7d0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7e0:  0x0000000000065ef8 <runtime.sighandler+0x0000000000000118>  0x0000003fb00ba820 
0x0000003fb005b7f0:  0x0000000000158554 <runtime/pprof.cpuHog1+0x0000000000000014>  0x0000003fb002ef58 
0x0000003fb005b800:  0x00000000001584d4 <runtime/pprof.cpuHogger+0x000000000000005c>  0x0000000000065f98 <runtime.sighandler+0x00000000000001b8> 
0x0000003fb005b810:  0x000000000006605c <runtime.sighandler+0x000000000000027c>  0x0000000000280638 
0x0000003fb005b820:  0x00000000002b6f80  0x0000000000065ad4 <runtime.sigtrampgo+0x000000000000019c> 
0x0000003fb005b830:  0x0000003fb00ba820  0x0000003fb005b8c8 
0x0000003fb005b840:  0x00000000001584d4 <runtime/pprof.cpuHogger+0x000000000000005c>  0x0000003fb00ba820 
0x0000003fb005b850:  0x0000003fb0030800  0x0000000000000000 
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:719 +0x29c

goroutine 8 [running]:
fatal error: unexpected signal during runtime execution
panic during panic
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x767d0]

goroutine 0 [idle]:
runtime: unexpected return pc for runtime.sigpanic called from 0x2
stack: frame={sp:0x3fb005b730, fp:0x3fb005b760} stack=[0x3fb0054000,0x3fb005c000)
0x0000003fb005b630:  0x0000000000000000  0x000000000004cb6c <runtime.fatalthrow.func1+0x000000000000005c> 
0x0000003fb005b640:  0x0000003fb0000ea0  0x0000003fb005b708 
0x0000003fb005b650:  0x0000000000000000  0x0000003fb0000ea0 
0x0000003fb005b660:  0x010000000004cea4  0x0000000000000004 
0x0000003fb005b670:  0x000000000000001f  0x0000000000000002 
0x0000003fb005b680:  0x0000000000000002  0x0000000000000001 
0x0000003fb005b690:  0x00000000001ae451  0x000000000004cafc <runtime.fatalthrow+0x000000000000004c> 
0x0000003fb005b6a0:  0x0000003fb0000ea0  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b6b0:  0x0000003fb005b708  0x000000000004e4d8 <runtime.printunlock+0x0000000000000058> 
0x0000003fb005b6c0:  0x0000003fb005b708  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b6d0:  0x0000003fb0000ea0  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b6e0:  0x0000003fb005b6e8  0x000000000004cb10 <runtime.fatalthrow.func1+0x0000000000000000> 
0x0000003fb005b6f0:  0x0000003fb0000ea0  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b700:  0x0000003fb005b708  0x0000000000066a3c <runtime.sigpanic+0x000000000000029c> 
0x0000003fb005b710:  0x0000003fb005b718  0x000000000004c8d8 <runtime.throw.func1+0x0000000000000000> 
0x0000003fb005b720:  0x00000000001b170e  0x000000000000002a 
0x0000003fb005b730: <0x0000000000000002  0x00000000001b170e 
0x0000003fb005b740:  0x000000000000002a  0x0000000000000080 
0x0000003fb005b750:  0x0000000000000003  0x0000000000000000 
0x0000003fb005b760: >0x0000000000000003  0x00000000000658a4 <runtime.doSigPreempt+0x00000000000000bc> 
0x0000003fb005b770:  0x0000000000158554 <runtime/pprof.cpuHog1+0x0000000000000014>  0x00000000002a7328 
0x0000003fb005b780:  0x00000000002b6f80  0x0000000000000000 
0x0000003fb005b790:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7a0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7b0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7c0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7d0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7e0:  0x0000000000065ef8 <runtime.sighandler+0x0000000000000118>  0x0000003fb00ba820 
0x0000003fb005b7f0:  0x0000000000158554 <runtime/pprof.cpuHog1+0x0000000000000014>  0x0000003fb002ef58 
0x0000003fb005b800:  0x00000000001584d4 <runtime/pprof.cpuHogger+0x000000000000005c>  0x0000000000065f98 <runtime.sighandler+0x00000000000001b8> 
0x0000003fb005b810:  0x000000000006605c <runtime.sighandler+0x000000000000027c>  0x0000000000280638 
0x0000003fb005b820:  0x00000000002b6f80  0x0000000000065ad4 <runtime.sigtrampgo+0x000000000000019c> 
0x0000003fb005b830:  0x0000003fb00ba820  0x0000003fb005b8c8 
0x0000003fb005b840:  0x00000000001584d4 <runtime/pprof.cpuHogger+0x000000000000005c>  0x0000003fb00ba820 
0x0000003fb005b850:  0x0000003fb0030800  0x0000000000000000 
runtime.throw({0x1b170e, 0x2a})
	/usr/local/go/src/runtime/panic.go:1198 +0x60
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:719 +0x29c
runtime.gentraceback(0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x3fb00ba820, 0x0, 0x0, 0x64, 0x0, 0x0, 0x0)
	/usr/local/go/src/runtime/traceback.go:247 +0x4d8
runtime.traceback1(0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x3fb00ba820, 0x0)
	/usr/local/go/src/runtime/traceback.go:823 +0x14c
runtime.traceback(...)
	/usr/local/go/src/runtime/traceback.go:777
runtime.tracebackothers(0x3fb0000ea0)
	/usr/local/go/src/runtime/traceback.go:1015 +0xcc
runtime.dopanic_m(0x3fb0000ea0, 0x4c8c0, 0x3fb005b708)
	/usr/local/go/src/runtime/panic.go:1398 +0x350
runtime.fatalthrow.func1()
	/usr/local/go/src/runtime/panic.go:1253 +0x5c
runtime.fatalthrow()
	/usr/local/go/src/runtime/panic.go:1250 +0x4c
runtime.throw({0x1b170e, 0x2a})
	/usr/local/go/src/runtime/panic.go:1198 +0x60
runtime: unexpected return pc for runtime.sigpanic called from 0x2
stack: frame={sp:0x3fb005b730, fp:0x3fb005b760} stack=[0x3fb0054000,0x3fb005c000)
0x0000003fb005b630:  0x0000000000000000  0x000000000004cb6c <runtime.fatalthrow.func1+0x000000000000005c> 
0x0000003fb005b640:  0x0000003fb0000ea0  0x0000003fb005b708 
0x0000003fb005b650:  0x0000000000000000  0x0000003fb0000ea0 
0x0000003fb005b660:  0x010000000004cea4  0x0000000000000004 
0x0000003fb005b670:  0x000000000000001f  0x0000000000000002 
0x0000003fb005b680:  0x0000000000000002  0x0000000000000001 
0x0000003fb005b690:  0x00000000001ae451  0x000000000004cafc <runtime.fatalthrow+0x000000000000004c> 
0x0000003fb005b6a0:  0x0000003fb0000ea0  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b6b0:  0x0000003fb005b708  0x000000000004e4d8 <runtime.printunlock+0x0000000000000058> 
0x0000003fb005b6c0:  0x0000003fb005b708  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b6d0:  0x0000003fb0000ea0  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b6e0:  0x0000003fb005b6e8  0x000000000004cb10 <runtime.fatalthrow.func1+0x0000000000000000> 
0x0000003fb005b6f0:  0x0000003fb0000ea0  0x000000000004c8c0 <runtime.throw+0x0000000000000060> 
0x0000003fb005b700:  0x0000003fb005b708  0x0000000000066a3c <runtime.sigpanic+0x000000000000029c> 
0x0000003fb005b710:  0x0000003fb005b718  0x000000000004c8d8 <runtime.throw.func1+0x0000000000000000> 
0x0000003fb005b720:  0x00000000001b170e  0x000000000000002a 
0x0000003fb005b730: <0x0000000000000002  0x00000000001b170e 
0x0000003fb005b740:  0x000000000000002a  0x0000000000000080 
0x0000003fb005b750:  0x0000000000000003  0x0000000000000000 
0x0000003fb005b760: >0x0000000000000003  0x00000000000658a4 <runtime.doSigPreempt+0x00000000000000bc> 
0x0000003fb005b770:  0x0000000000158554 <runtime/pprof.cpuHog1+0x0000000000000014>  0x00000000002a7328 
0x0000003fb005b780:  0x00000000002b6f80  0x0000000000000000 
0x0000003fb005b790:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7a0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7b0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7c0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7d0:  0x0000000000000000  0x0000000000000000 
0x0000003fb005b7e0:  0x0000000000065ef8 <runtime.sighandler+0x0000000000000118>  0x0000003fb00ba820 
0x0000003fb005b7f0:  0x0000000000158554 <runtime/pprof.cpuHog1+0x0000000000000014>  0x0000003fb002ef58 
0x0000003fb005b800:  0x00000000001584d4 <runtime/pprof.cpuHogger+0x000000000000005c>  0x0000000000065f98 <runtime.sighandler+0x00000000000001b8> 
0x0000003fb005b810:  0x000000000006605c <runtime.sighandler+0x000000000000027c>  0x0000000000280638 
0x0000003fb005b820:  0x00000000002b6f80  0x0000000000065ad4 <runtime.sigtrampgo+0x000000000000019c> 
0x0000003fb005b830:  0x0000003fb00ba820  0x0000003fb005b8c8 
0x0000003fb005b840:  0x00000000001584d4 <runtime/pprof.cpuHogger+0x000000000000005c>  0x0000003fb00ba820 
0x0000003fb005b850:  0x0000003fb0030800  0x0000000000000000 
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:719 +0x29c


ERROR: exit status 2
"runtime: unexpected return pc for runtime.sigpanic called from 0x0" / "fatal error: unknown caller pc"
sipeed@sipeed:~$ cat /tmp/go-stress-20211121T161735-4026159646
runtime: unexpected return pc for runtime.sigpanic called from 0x0
stack: frame={sp:0x3fb405b910, fp:0x3fb405b940} stack=[0x3fb402e800,0x3fb402f000)

fatal error: unknown caller pc

runtime stack:
runtime.throw({0x1aa247, 0x11})
	/usr/local/go/src/runtime/panic.go:1198 +0x60
runtime.gentraceback(0x49820, 0x3fb405b8f8, 0x0, 0x3fb40ba820, 0x0, 0x0, 0x7fffffff, 0x3fb403bfc0, 0x0, 0x0)
	/usr/local/go/src/runtime/traceback.go:274 +0x17c0
runtime.addOneOpenDeferFrame.func1()
	/usr/local/go/src/runtime/panic.go:751 +0x88
runtime.systemstack()
	/usr/local/go/src/runtime/asm_riscv64.s:131 +0x58

goroutine 8 [running]:
runtime.systemstack_switch()
	/usr/local/go/src/runtime/asm_riscv64.s:94 +0x8 fp=0x3fb405b7f0 sp=0x3fb405b7e8 pc=0x80768
runtime.addOneOpenDeferFrame(0x3fb40ba820, 0x49820, 0x3fb405b8f8)
	/usr/local/go/src/runtime/panic.go:750 +0x80 fp=0x3fb405b828 sp=0x3fb405b7f0 pc=0x4b160
panic({0x1871a0, 0x2c5ab0})
	/usr/local/go/src/runtime/panic.go:998 +0xcc fp=0x3fb405b8f8 sp=0x3fb405b828 pc=0x4c09c
runtime.panicmem()
	/usr/local/go/src/runtime/panic.go:221 +0x60 fp=0x3fb405b910 sp=0x3fb405b8f8 pc=0x49820
runtime: unexpected return pc for runtime.sigpanic called from 0x0
stack: frame={sp:0x3fb405b910, fp:0x3fb405b940} stack=[0x3fb402e800,0x3fb402f000)

runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:735 +0x264 fp=0x3fb405b940 sp=0x3fb405b910 pc=0x66a04
created by runtime/pprof.TestCPUProfileMultithreaded.func1
	/usr/local/go/src/runtime/pprof/pprof_test.go:100 +0x64

goroutine 1 [chan receive]:
testing.(*T).Run(0x3fb40ba1a0, {0x1acff7, 0x1b}, 0x1b7750)
	/usr/local/go/src/testing/testing.go:1307 +0x3a8
testing.runTests.func1(0x3fb40ba1a0)
	/usr/local/go/src/testing/testing.go:1598 +0x84
testing.tRunner(0x3fb40ba1a0, 0x3fb409dd50)
	/usr/local/go/src/testing/testing.go:1259 +0xf8
testing.runTests(0x3fb400a030, {0x2cb500, 0x1e, 0x1e}, {0x0, 0x0, 0x0})
	/usr/local/go/src/testing/testing.go:1596 +0x434
testing.(*M).Run(0x3fb40a4680)
	/usr/local/go/src/testing/testing.go:1504 +0x574
main.main()
	_testmain.go:101 +0x174

goroutine 6 [runnable]:
runtime/pprof.cpuHog2(0x0)
	/usr/local/go/src/runtime/pprof/pprof_test.go:71 +0x1c
runtime/pprof.cpuHogger(0x1b7940, 0x2fc268, 0x5f5e100)
	/usr/local/go/src/runtime/pprof/pprof_test.go:40 +0x5c
runtime/pprof.TestCPUProfileMultithreaded.func1(0x5f5e100)
	/usr/local/go/src/runtime/pprof/pprof_test.go:104 +0x8c
runtime/pprof.testCPUProfile(0x3fb40ba340, 0x1b79b8, {0x3fb4062f58, 0x2, 0x2}, {0x0, 0x0, 0x0}, 0x1b7748)
	/usr/local/go/src/runtime/pprof/pprof_test.go:324 +0x108
runtime/pprof.TestCPUProfileMultithreaded(0x3fb40ba340)
	/usr/local/go/src/runtime/pprof/pprof_test.go:98 +0xd0
testing.tRunner(0x3fb40ba340, 0x1b7750)
	/usr/local/go/src/testing/testing.go:1259 +0xf8
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1306 +0x388

goroutine 7 [sleep]:
time.Sleep(0x5f5e100)
	/usr/local/go/src/runtime/time.go:193 +0x16c
runtime/pprof.profileWriter({0x1e0400, 0x3fb400e8a0})
	/usr/local/go/src/runtime/pprof/pprof.go:799 +0x68
created by runtime/pprof.StartCPUProfile
	/usr/local/go/src/runtime/pprof/pprof.go:784 +0x190


ERROR: exit status 2
"fatal error: runtime: split stack overflow"
sipeed@sipeed:~$ cat /tmp/go-stress-20211121T161735-2006060682
runtime: newstack sp=0x3fa80098d0 stack=[0x3fa8062000, 0x3fa8063000]
	morebuf={pc:0x0 sp:0x3fa80098d0 lr:0x0}
	sched={pc:0x667b0 sp:0x3fa80098d0 lr:0x0 ctxt:0x0}
runtime: gp=0x3fa80bc340, goid=6, gp->status=0x2
 runtime: split stack overflow: 0x3fa80098d0 < 0x3fa8062000
fatal error: runtime: split stack overflow

runtime stack:
runtime.throw({0x1add89, 0x1d})
	/usr/local/go/src/runtime/panic.go:1198 +0x60
runtime.newstack()
	/usr/local/go/src/runtime/stack.go:1032 +0x850
runtime.morestack()
	/usr/local/go/src/runtime/asm_riscv64.s:202 +0x70

goroutine 6 [running]:
runtime: unexpected return pc for runtime.sigpanic called from 0x0
stack: frame={sp:0x3fa80098d0, fp:0x3fa80098d0} stack=[0x3fa8062000,0x3fa8063000)

runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:716 +0x10 fp=0x3fa80098d0 sp=0x3fa80098d0 pc=0x667b0
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1306 +0x388

goroutine 1 [chan receive]:
testing.(*T).Run(0x3fa80bc000, {0x1acff7, 0x1b}, 0x1b7750)
	/usr/local/go/src/testing/testing.go:1307 +0x3a8
testing.runTests.func1(0x3fa80bc000)
	/usr/local/go/src/testing/testing.go:1598 +0x84
testing.tRunner(0x3fa80bc000, 0x3fa809dd50)
	/usr/local/go/src/testing/testing.go:1259 +0xf8
testing.runTests(0x3fa800a030, {0x2cb500, 0x1e, 0x1e}, {0x0, 0x0, 0x0})
	/usr/local/go/src/testing/testing.go:1596 +0x434
testing.(*M).Run(0x3fa80a4680)
	/usr/local/go/src/testing/testing.go:1504 +0x574
main.main()
	_testmain.go:101 +0x174

goroutine 7 [sleep]:
time.Sleep(0x5f5e100)
	/usr/local/go/src/runtime/time.go:193 +0x16c
runtime/pprof.profileWriter({0x1e0400, 0x3fa800e8a0})
	/usr/local/go/src/runtime/pprof/pprof.go:799 +0x68
created by runtime/pprof.StartCPUProfile
	/usr/local/go/src/runtime/pprof/pprof.go:784 +0x190

goroutine 8 [runnable]:
runtime/pprof.cpuHog0(...)
	/usr/local/go/src/runtime/pprof/pprof_test.go:59
runtime/pprof.cpuHog1(0x0)
	/usr/local/go/src/runtime/pprof/pprof_test.go:54 +0xc
runtime/pprof.cpuHogger(0x1b7938, 0x2fc260, 0x5f5e100)
	/usr/local/go/src/runtime/pprof/pprof_test.go:40 +0x5c
runtime/pprof.TestCPUProfileMultithreaded.func1.1(0x5f5e100, 0x3fa805c3c0)
	/usr/local/go/src/runtime/pprof/pprof_test.go:101 +0x44
created by runtime/pprof.TestCPUProfileMultithreaded.func1
	/usr/local/go/src/runtime/pprof/pprof_test.go:100 +0x64


ERROR: exit status 2

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (14 by maintainers)

Most upvoted comments

On linux/amd64, adding strace -f -ttt -e rt_sigaction shows lines that set sa_mask=~[], which I take to mean “all bits set”.

On linux/riscv64, the strace output shows sa_mask=[], which I take to mean “all bits cleared”. When I modify runtime.setsig to set the sa_restorer field, I see it reflected in strace’s view of the sa_mask field.

It looks from this like the definition of runtime.sigactiont is not correct on linux/riscv64, resulting in no signals at all being blocked when handling a signal.

https://github.com/golang/go/blob/f598e2962d3a358b59faa68471b6ed378fc68806/src/runtime/defs_linux_riscv64.go#L124-L129