go build fails under qemu-ppc64le-static (qemu-user)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Expired
|
Undecided
|
Unassigned |
Bug Description
I am using qemu-user (built static) in a docker container environment. When running multi-threaded go commands in the container (go build for example) the process may hang, report segfaults or other errors. I built qemu-ppc64le from the upstream git (master).
I see the problem running on a multi core system with Intel i7 processors.
# cat /proc/cpuinfo | grep "model name"
model name : Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
model name : Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
model name : Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
model name : Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
model name : Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
model name : Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
model name : Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
model name : Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
Steps to reproduce:
1) Build qemu-ppc64le as static and copy into docker build directory named it qemu-ppc64le-
2) Add hello.go to docker build dir.
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
3) Create the Dockerfile from below:
FROM ppc64le/
COPY qemu-ppc64le-static /usr/bin/
COPY hello.go /go
4) Build container
$ docker build -t qemutest -f Dockerfile ./go
5) Run test
$ docker run -it qemutest
/go # /usr/bin/
qemu-ppc64le version 2.11.93 (v2.12.0-rc3-dirty)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
/go # go version
go version go1.10.1 linux/ppc64le
/go # go build hello.go
fatal error: fatal error: stopm holding locksunexpected signal during runtime execution
panic during panic
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1003528c]
runtime stack:
runtime: unexpected return pc for syscall.Syscall6 called from 0xc42007f500
stack: frame={
syscall.
]
runtime stack:
/usr/local/
+ /usr/local/
runtime.stopm()
/usr/local/
[runtime.
/usr/local/
0x130
runtime.
/usr/local/
(0xc4201fab1c)
/usr/local/
----
Note the results may differ between attempts, hangs and other faults sometimes happen.
----
If I run "go: single threaded I don't see the problem, for example:
/go # GOMAXPROCS=1 go build -p 1 hello.go
/go # ./hello
hello world
I see the same issue with arm64. I don't think this is a go issue, but don't have a real evidence to prove that. This problem looks similar to other problem I have seen reported against qemu running multi-threaded applications.
summary: |
- go buld failes under qemu-ppc64le-static (qemu-user) + go build fails under qemu-ppc64le-static (qemu-user) |
I missed a step for reproduction. Step 1 should be: qemu-user- static: register
docker run --rm --privileged multiarch/
This modprobes binfmt and registers qemu-ppc64le-static as the interpreter for ppc64le executables.