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: SIGSEGV when building on freebsd ARM #25770

Open
artooro opened this Issue Jun 7, 2018 · 17 comments

Comments

Projects
None yet
7 participants
@artooro

artooro commented Jun 7, 2018

Trying to build go on freebsd-arm. I've tried both 1.10.2 and master branch from git. Both have the same issue.

I was able to bootstrap with go14 just fine, and the output of go env is

GOARCH="arm"
GOBIN=""
GOCHAR="5"
GOEXE=""
GOHOSTARCH="arm"
GOHOSTOS="freebsd"
GOOS="freebsd"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go14"
GOTOOLDIR="/usr/local/go14/pkg/tool/freebsd_arm"
CC="/nxb-bin/usr/bin/cc"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

What did you do?

I built a new jail on my freebsd 11.1 machine as follows
poudriere jail -c -j 111armv6 -a arm.armv6 -x -m git -U https://github.com/freebsd/freebsd.git -v releng/11.1

To build go I ran:
poudriere bulk -j 111armv6 -i -v lang/go

To further troubleshoot from inside the jail I ran make.bash directly via:
GOROOT_BOOTSTRAP=/usr/local/go14 ./make.bash

What did you expect to see?

I expected it to build. And it does build if everything else is equal and all I do is make the jail amd64 instead of arm, everything is fine.

What did you see instead?

Build output below. I've been able to reproduce this on both a physical server running freebsd 11.1 bare metal and also on a virtual machine.

Building Go cmd/dist using /usr/local/go14.
Building Go toolchain1 using /usr/local/go14.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x0 addr=0x0 pc=0x3714c]

runtime stack:
runtime.throw(0x2ade9a, 0x2a)
        /root/go/src/runtime/panic.go:589 +0x4c
runtime.sigpanic()
        /root/go/src/runtime/signal_unix.go:374 +0x22c
runtime.netpollunblock(0x0, 0x77, 0x1, 0x0)
        /root/go/src/runtime/netpoll.go:377 +0x14
runtime.netpollready(0x83fa10, 0x0, 0x77)
        /root/go/src/runtime/netpoll.go:301 +0x74
runtime.netpoll(0x488600, 0x255bfa99)
        /root/go/src/runtime/netpoll_kqueue.go:111 +0xc4
runtime.sysmon()
        /root/go/src/runtime/proc.go:4375 +0x55c
runtime.mstart1()
        /root/go/src/runtime/proc.go:1275 +0xbc
runtime.mstart()
        /root/go/src/runtime/proc.go:1241 +0x60

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0x874664)
        /root/go/src/runtime/sema.go:56 +0x2c
sync.(*WaitGroup).Wait(0x874664)
        /root/go/src/sync/waitgroup.go:130 +0x84
cmd/go/internal/work.(*Builder).Do(0x8ad620, 0xb55810)
        /root/go/src/cmd/go/internal/work/exec.go:174 +0x304
cmd/go/internal/work.InstallPackages(0x80e078, 0x4, 0x5, 0x0)
        /root/go/src/cmd/go/internal/work/build.go:481 +0x9e0
cmd/go/internal/work.runInstall(0x484f30, 0x80e078, 0x4, 0x5)
        /root/go/src/cmd/go/internal/work/build.go:412 +0x38
main.main()
        /root/go/src/cmd/go/main.go:140 +0x660

goroutine 4 [syscall]:
os/signal.signal_recv(0x0)
        /root/go/src/runtime/sigqueue.go:139 +0x130
os/signal.loop()
        /root/go/src/os/signal/signal_unix.go:23 +0x14
created by os/signal.init.0
        /root/go/src/os/signal/signal_unix.go:29 +0x30

goroutine 8 [runnable]:
syscall.BytePtrFromString(0xa96030, 0x25, 0x3, 0x9720e0, 0x3)
        /root/go/src/syscall/syscall.go:71 +0x80
syscall.SlicePtrFromStrings(0x8e8010, 0x2, 0x2, 0x0, 0x0, 0x4f86c, 0x822008, 0x2)
        /root/go/src/syscall/exec_unix.go:87 +0x9c
syscall.forkExec(0xa96030, 0x25, 0x8e8010, 0x2, 0x2, 0xc934b0, 0x10, 0x0, 0x994040)
        /root/go/src/syscall/exec_unix.go:155 +0xa4
syscall.StartProcess(0xa96030, 0x25, 0x8e8010, 0x2, 0x2, 0xc934b0, 0x2, 0x4, 0x0, 0x0)
        /root/go/src/syscall/exec_unix.go:241 +0x44
os.startProcess(0xa96030, 0x25, 0x8e8010, 0x2, 0x2, 0xc93570, 0x9c0780, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:46 +0x144
os.StartProcess(0xa96030, 0x25, 0x8e8010, 0x2, 0x2, 0xc93570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0xb51080, 0x29f201, 0x91a060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0xb51080, 0x91a060, 0x91e000)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xbec974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xc41a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xc41a20, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xc41a20)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 9 [runnable]:
syscall.forkExecPipe(0xc59420, 0x2, 0x2, 0xb9c000, 0x30)
        /root/go/src/syscall/forkpipe2.go:9 +0x50
syscall.forkExec(0xade000, 0x25, 0xb16010, 0x2, 0x2, 0xc594b0, 0x10, 0x0, 0x8e2110)
        /root/go/src/syscall/exec_unix.go:189 +0x1b8
syscall.StartProcess(0xade000, 0x25, 0xb16010, 0x2, 0x2, 0xc594b0, 0x2, 0x4, 0x0, 0x0)
        /root/go/src/syscall/exec_unix.go:241 +0x44
os.startProcess(0xade000, 0x25, 0xb16010, 0x2, 0x2, 0xc59570, 0x92e480, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:46 +0x144
os.StartProcess(0xade000, 0x25, 0xb16010, 0x2, 0x2, 0xc59570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0xc40580, 0x29f201, 0xa86060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0xc40580, 0xa86060, 0x92e180)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xb38974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xc41080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xc41080, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xc41080)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 10 [runnable]:
os.startProcess(0xa78060, 0x25, 0xc6e010, 0x2, 0x2, 0xa0b570, 0x956480, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:43 +0xf4
os.StartProcess(0xa78060, 0x25, 0xc6e010, 0x2, 0x2, 0xa0b570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0xbc2e70, 0x29f201, 0x8ac2a0)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0xbc2e70, 0x8ac2a0, 0x956180)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xb66974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xc418c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xc418c0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xc418c0)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 11 [runnable]:
syscall.SetNonblock(0x1a, 0x2c3a00, 0x9400c0, 0x4)
        /root/go/src/syscall/exec_unix.go:98 +0x98
internal/poll.(*FD).SetBlocking(0x9400c0, 0x0, 0x0)
        /root/go/src/internal/poll/fd_unix.go:128 +0x80
os.(*File).Fd(0xbe2050, 0x0)
        /root/go/src/os/file_unix.go:70 +0x44
os.startProcess(0xa08030, 0x25, 0xcde010, 0x2, 0x2, 0x899570, 0x94e600, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:43 +0xb8
os.StartProcess(0xa08030, 0x25, 0xcde010, 0x2, 0x2, 0x899570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0x9ec8f0, 0x29f201, 0x9e8060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0x9ec8f0, 0x9e8060, 0x94e300)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xb3c974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xb52630, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xb52630, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xb52630)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 12 [runnable]:
sync.runtime_canSpin(0x0, 0x0)
        /root/go/src/runtime/proc.go:5050 +0x64
sync.(*Mutex).Lock(0x498678)
        /root/go/src/sync/mutex.go:89 +0x2c0
sync.(*RWMutex).Lock(0x498678)
        /root/go/src/sync/rwmutex.go:93 +0x20
syscall.forkExec(0x8f42a0, 0x25, 0x972030, 0x2, 0x2, 0xa0f4b0, 0x10, 0x0, 0xb18040)
        /root/go/src/syscall/exec_unix.go:186 +0x1a0
syscall.StartProcess(0x8f42a0, 0x25, 0x972030, 0x2, 0x2, 0xa0f4b0, 0x2, 0x4, 0x0, 0x0)
        /root/go/src/syscall/exec_unix.go:241 +0x44
os.startProcess(0x8f42a0, 0x25, 0x972030, 0x2, 0x2, 0xa0f570, 0x91ec00, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:46 +0x144
os.StartProcess(0x8f42a0, 0x25, 0x972030, 0x2, 0x2, 0xa0f570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0xb53d90, 0x29f201, 0xa5e060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0xb53d90, 0xa5e060, 0x9c0480)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xbe8974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xbc0b00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xbc0b00, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xbc0b00)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 13 [runnable]:
syscall.BytePtrFromString(0x8f0030, 0x25, 0xca3e5201, 0xb, 0x8015e0)
        /root/go/src/syscall/syscall.go:71 +0x80
syscall.forkExec(0x8f0030, 0x25, 0xb88010, 0x2, 0x2, 0xc554b0, 0x10, 0x0, 0xa88040)
        /root/go/src/syscall/exec_unix.go:151 +0x70
syscall.StartProcess(0x8f0030, 0x25, 0xb88010, 0x2, 0x2, 0xc554b0, 0x2, 0x4, 0x0, 0x0)
        /root/go/src/syscall/exec_unix.go:241 +0x44
os.startProcess(0x8f0030, 0x25, 0xb88010, 0x2, 0x2, 0xc55570, 0x93ea80, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:46 +0x144
os.StartProcess(0x8f0030, 0x25, 0xb88010, 0x2, 0x2, 0xc55570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0xc088f0, 0x29f201, 0x9fe060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0xc088f0, 0x9fe060, 0x93e000)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xbcc974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xc40c60, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xc40c60, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xc40c60)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 14 [runnable]:
os.(*File).Fd(0xa6e078, 0x14)
        /root/go/src/os/file_unix.go:59 +0x60
os.startProcess(0xb60030, 0x25, 0x8ca020, 0x2, 0x2, 0xcab570, 0x9d6300, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:43 +0xb8
os.StartProcess(0xb60030, 0x25, 0x8ca020, 0x2, 0x2, 0xcab570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0xb55600, 0x29f201, 0xa70060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0xb55600, 0xa70060, 0x9d6000)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xbd0974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xc40a50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xc40a50, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xc40a50)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4

goroutine 15 [runnable]:
syscall.SlicePtrFromStrings(0x938480, 0x2f, 0x2f, 0x8e0930, 0x3, 0x3, 0x0, 0x0)
        /root/go/src/syscall/exec_unix.go:85 +0x2c
syscall.forkExec(0xc52360, 0x25, 0x8e08c0, 0x2, 0x2, 0xca54b0, 0x10, 0x0, 0x874820)
        /root/go/src/syscall/exec_unix.go:159 +0xec
syscall.StartProcess(0xc52360, 0x25, 0x8e08c0, 0x2, 0x2, 0xca54b0, 0x2, 0x4, 0x0, 0x0)
        /root/go/src/syscall/exec_unix.go:241 +0x44
os.startProcess(0xc52360, 0x25, 0x8e08c0, 0x2, 0x2, 0xca5570, 0x938480, 0x2f, 0x2f)
        /root/go/src/os/exec_posix.go:46 +0x144
os.StartProcess(0xc52360, 0x25, 0x8e08c0, 0x2, 0x2, 0xca5570, 0x0, 0x0, 0x5f814)
        /root/go/src/os/exec.go:102 +0x58
os/exec.(*Cmd).Start(0x9bba20, 0x29f201, 0x946060)
        /root/go/src/os/exec/exec.go:381 +0x344
os/exec.(*Cmd).Run(0x9bba20, 0x946060, 0x938000)
        /root/go/src/os/exec/exec.go:304 +0x1c
cmd/go/internal/work.(*Builder).toolID(0x8ad620, 0x2a0569, 0x7, 0x2c, 0xb6a974)
        /root/go/src/cmd/go/internal/work/buildid.go:183 +0x240
cmd/go/internal/work.(*Builder).buildActionID(0x8ad620, 0xc41340, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:220 +0xb80
cmd/go/internal/work.(*Builder).build(0x8ad620, 0xc41340, 0x0, 0x0)
        /root/go/src/cmd/go/internal/work/exec.go:328 +0x37f8
cmd/go/internal/work.(*Builder).Do.func1(0xc41340)
        /root/go/src/cmd/go/internal/work/exec.go:107 +0x58
cmd/go/internal/work.(*Builder).Do.func2(0x874664, 0x8ad620, 0x8e08a0)
        /root/go/src/cmd/go/internal/work/exec.go:165 +0x84
created by cmd/go/internal/work.(*Builder).Do
        /root/go/src/cmd/go/internal/work/exec.go:152 +0x2e4
go tool dist: FAILED: /root/go/pkg/tool/freebsd_arm/go_bootstrap install -gcflags=all= -ldflags=all= -i cmd/asm cmd/cgo cmd/compile cmd/link: exit status 2
# 
@davecheney

This comment has been minimized.

Contributor

davecheney commented Jun 7, 2018

runtime.netpollunblock(0x0, 0x77, 0x1, 0x0)
        /root/go/src/runtime/netpoll.go:377 +0x14

^ something passed a nil pollDesc to netpollunblock, this came from runtime.netpoll

                case _EVFILT_WRITE:

                        mode += 'w'

                }

                if mode != 0 {

                        netpollready(&gp, (*pollDesc)(unsafe.Pointer(ev.udata)), mode)

                }

So ev.udata was nil. It's possible that the definition of the kqueue event type is not correct on freebsd/arm

@ianlancetaylor

This comment has been minimized.

Contributor

ianlancetaylor commented Jun 7, 2018

You say "I was able to bootstrap with go14 just fine". Does that mean that you were able to build 1.4, or that you were able to use 1.4 to build 1.10.2? Does the problem only occur in a jail, or does it always happen?

We do have a freebsd-arm builder, and it seems to be mostly working.

@davecheney

This comment has been minimized.

Contributor

davecheney commented Jun 7, 2018

@artooro

This comment has been minimized.

artooro commented Jun 7, 2018

@ianlancetaylor I meant I was able to build 1.4.
I've only tried in a jail so far, as my build system requires that I use poudriere.

@davecheney according to https://golang.org/doc/install/source it says to bootstrap using go1.4. Maybe I'm not understanding the terms, essentially I am looking at the Makefile from here https://svnweb.freebsd.org/ports/head/lang/go/Makefile?view=markup which depends on go14 in order to build go 1.10.2.

I'll try building as ARM outside of the poudriere jail to see if that makes a difference and report back.

@artooro

This comment has been minimized.

artooro commented Jun 7, 2018

So building outside of poudriere works fine. Of note poudriere runs the arm jail in a qemu-arm-static emulator. Perhaps it's related to that.

@artooro

This comment has been minimized.

artooro commented Jun 7, 2018

I am wondering if this issue is related to issue #24656 and perhaps that fix just needs to be ported to the freebsd side.

@artooro

This comment has been minimized.

artooro commented Jun 7, 2018

After copying the change from https://go-review.googlesource.com/c/go/+/111176/7/src/runtime/os_linux.go#416 to os_freebsd.go I end up with the following.
Sorry for the chain of comments, I'm not sure where to go next with this.

Building Go cmd/dist using /usr/local/go14.
Building Go toolchain1 using /usr/local/go14.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
fatal error: unexpected signal during runtime execution
fatal error: unexpected signal during runtime execution
panic during panic
[signal SIGSEGV: segmentation violation code=0x0 addr=0x978 pc=0x63c84]

runtime stack:
runtime: unexpected return pc for runtime.startpanic_m called from 0x8002a0
stack: frame={sp:0x83f920, fp:0x83f934} stack=[0x83e000,0x840000)
0083f8a0:  00000978  00000000  002a9bf0  0003a014 <runtime.fatalthrow+44> 
0083f8b0:  008002a0  00039e8c <runtime.throw+76>  0083f8e4  0049848c 
0083f8c0:  0083f8e4  00039e8c <runtime.throw+76>  008002a0  00039e8c <runtime.throw+76> 
0083f8d0:  0083f8d4  00060c2c <runtime.fatalthrow.func1+0>  008002a0  00039e8c <runtime.throw+76> 
0083f8e0:  0083f8e4  0004e4dc <runtime.sigpanic+556>  0083f8ec  00060bc0 <runtime.throw.func1+0> 
0083f8f0:  002ade9a  0000002a  00063c84 <runtime.gcWriteBarrier+12>  002ade9a 
0083f900:  0000002a  0003a9b0 <runtime.gwrite+216>  00000002  0029eb65 
0083f910:  008002a0  00000001  0003b174 <runtime.printstring+96>  0003a194 <runtime.startpanic_m+220> 
0083f920: <008002a0  00000001  00060c58 <runtime.fatalthrow.func1+44>  0000002a 
0083f930:  00018d1c <runtime.unlock+40> >0049848c  008002a0  0003a014 <runtime.fatalthrow+44> 
0083f940:  0029eb01  00000001  0003a8c0 <runtime.printunlock+60>  0049848c 
0083f950:  0083f974  00039e8c <runtime.throw+76>  008002a0  00039e8c <runtime.throw+76> 
0083f960:  0083f964  00060c2c <runtime.fatalthrow.func1+0>  008002a0  00039e8c <runtime.throw+76> 
0083f970:  0083f974  0004e4dc <runtime.sigpanic+556>  0083f97c  00060bc0 <runtime.throw.func1+0> 
0083f980:  002ade9a  0000002a  0003714c <runtime.netpollunblock+20>  002ade9a 
0083f990:  0000002a  00000000  00000000  00000000 
0083f9a0:  008002a0  00000000  00000000  00036dec <runtime.netpollready+116> 
0083f9b0:  00036dec <runtime.netpollready+116> 
runtime.throw(0x2ade9a, 0x2a)
        /root/go/src/runtime/panic.go:589 +0x4c
runtime.sigpanic()
        /root/go/src/runtime/signal_unix.go:374 +0x22c
runtime.gcWriteBarrier(0x1, 0x60c58, 0x2a, 0x18d1c, 0x49848c, 0x8002a0, 0x3a014, 0x29eb01, 0x1, 0x3a8c0, ...)
        /root/go/src/runtime/asm_arm.s:899 +0xc
runtime: unexpected return pc for runtime.startpanic_m called from 0x8002a0
stack: frame={sp:0x83f920, fp:0x83f934} stack=[0x83e000,0x840000)
0083f8a0:  00000978  00000000  002a9bf0  0003a014 <runtime.fatalthrow+44> 
0083f8b0:  008002a0  00039e8c <runtime.throw+76>  0083f8e4  0049848c 
0083f8c0:  0083f8e4  00039e8c <runtime.throw+76>  008002a0  00039e8c <runtime.throw+76> 
0083f8d0:  0083f8d4  00060c2c <runtime.fatalthrow.func1+0>  008002a0  00039e8c <runtime.throw+76> 
0083f8e0:  0083f8e4  0004e4dc <runtime.sigpanic+556>  0083f8ec  00060bc0 <runtime.throw.func1+0> 
0083f8f0:  002ade9a  0000002a  00063c84 <runtime.gcWriteBarrier+12>  002ade9a 
0083f900:  0000002a  0003a9b0 <runtime.gwrite+216>  00000002  0029eb65 
0083f910:  008002a0  00000001  0003b174 <runtime.printstring+96>  0003a194 <runtime.startpanic_m+220> 
0083f920: <008002a0  00000001  00060c58 <runtime.fatalthrow.func1+44>  0000002a 
0083f930:  00018d1c <runtime.unlock+40> >0049848c  008002a0  0003a014 <runtime.fatalthrow+44> 
0083f940:  0029eb01  00000001  0003a8c0 <runtime.printunlock+60>  0049848c 
0083f950:  0083f974  00039e8c <runtime.throw+76>  008002a0  00039e8c <runtime.throw+76> 
0083f960:  0083f964  00060c2c <runtime.fatalthrow.func1+0>  008002a0  00039e8c <runtime.throw+76> 
0083f970:  0083f974  0004e4dc <runtime.sigpanic+556>  0083f97c  00060bc0 <runtime.throw.func1+0> 
0083f980:  002ade9a  0000002a  0003714c <runtime.netpollunblock+20>  002ade9a 
0083f990:  0000002a  00000000  00000000  00000000 
0083f9a0:  008002a0  00000000  00000000  00036dec <runtime.netpollready+116> 
0083f9b0:  00036dec <runtime.netpollready+116> 
fatal error: unexpected signal during runtime execution
runtime.startpanic_m(0x8002a0)
        /root/go/src/runtime/panic.go:722 +0xdc

goroutine 1 [semacquire[signal SIGSEGV: segmentation violation]:
 code=0x0 addr=0x0 pc=0x3714c]
sync.runtime_Semacquire(0xba7a14)
        /root/go/src/runtime/sema.go:56 +0x2c

runtime stack:
sync.(*WaitGroup).Wait(0xba7a14)
        /root/go/src/sync/waitgroup.go:130 +0x84
runtime.throw(0x2ade9acmd/go/internal/work.(*Builder).Do(0x8fb2c0, , 0x9bcdc0)
        /root/go/src/cmd/go/internal/work/exec.go:174 +0x304
cmd/go/internal/work.InstallPackages(0x80e078, 0x4, 0x5, 0x0)
        /root/go/src/cmd/go/internal/work/build.go:481 +0x9e0
cmd/go/internal/work.runInstall(0x484f30, 0x80e078, 0x4, 0x5)
        /root/go/src/cmd/go/internal/work/build.go:412 +0x38
main.main()
        /root/go/src/cmd/go/main.go:140 +0x660
0x2a)
        /root/go/src/runtime/panic.go:589
goroutine 5 [syscall]:
 +0x4c
runtime.sigpanic()
os/signal.signal_recv(0x0)
        /root/go/src/runtime/sigqueue.go:139 +0x130
        /root/go/src/runtime/signal_unix.go:374 +0x22cos/signal.loop()
        /root/go/src/os/signal/signal_unix.go:23 +0x14

runtime.netpollunblock(0x0, 0x77, 0x1, 0x0)
        /root/go/src/runtime/netpoll.go:377 +0x14
runtime.netpollready(0xdf19e4created by os/signal.init.0
, 0x0, 0x77)
        /root/go/src/runtime/netpoll.go:301 +0x74
        /root/go/src/os/signal/signal_unix.go:29runtime.netpoll(0x488600, 0x4bcf32fd)
        /root/go/src/runtime/netpoll_kqueue.go:111 +0xc4
runtime.findrunnable(0x81e600, 0x0)
        /root/go/src/runtime/proc.go:2308 +0x7fc
 +0x30runtime.schedule()
        /root/go/src/runtime/proc.go:2598 +0x114
runtime.park_m(0xc942a0)
        /root/go/src/runtime/proc.go:2661 +0x8c
runtime.mcall(0x0
)
        /root/go/src/runtime/asm_arm.s:285 +0x5c

goroutine 34 [runnable]:
sync.runtime_SemacquireMutex(0x49867c, 0x1)
        /root/go/src/runtime/sema.go:71 +0x2c
sync.(*Mutex).Lockgo tool dist: FAILED: /root/go/pkg/tool/freebsd_arm/go_bootstrap install -gcflags=all= -ldflags=all= -i cmd/asm cmd/cgo cmd/compile cmd/link: exit status 2
@ianlancetaylor

This comment has been minimized.

Contributor

ianlancetaylor commented Jun 7, 2018

@ianlancetaylor ianlancetaylor changed the title from SIGSEGV when building on freebsd ARM to runtime: SIGSEGV when building on freebsd ARM Jun 7, 2018

@tzdybal

This comment has been minimized.

tzdybal commented Jun 11, 2018

I have the same issue with FreeBSD 11.1-RELEASE-p10, amd64 architecture.
Go installed from packages stopped working recently (after update from 1.9.2 version), so I wanted to rebuild it from sources (ports).

The problem is visible only inside KVM guest - everything works fine on actual hardware.
I'm waiting for build of go with my own hack similar to the one from #24656. But it seems to be working, as compilation hasn't crash yet.

Some examples of my crashes (unmodified sources):

===>  Building for go-1.10.2,1
cd /usr/ports/lang/go/work/go/src &&  GOROOT=/usr/ports/lang/go/work/go GOROOT_FINAL=/usr/local/go  GOROOT_BOOTSTRAP=/usr/local/go14  GOBIN= GOARCH=amd64 GOOS=freebsd  GO386=  /bin/sh make.bash
-ap: not found
Building Go cmd/dist using /usr/local/go14.
Building Go toolchain1 using /usr/local/go14.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
fatal error: exitsyscall: syscall frame is no longer valid

runtime stack:
runtime.throw(0x6ff68b, 0x2d)
        /usr/local/go/src/runtime/panic.go:616 +0x81
runtime.exitsyscall.func1()
        /usr/local/go/src/runtime/proc.go:2941 +0x36
runtime.systemstack(0x0)
        /usr/local/go/src/runtime/asm_amd64.s:409 +0x79
runtime.mstart()
        /usr/local/go/src/runtime/proc.go:1175

goroutine 23 [running]:
runtime.systemstack_switch()
        /usr/local/go/src/runtime/asm_amd64.s:363 fp=0xc4201acf38 sp=0xc4201acf30 pc=0x450c00
runtime.exitsyscall(0x471957)
        /usr/local/go/src/runtime/proc.go:2940 +0x235 fp=0xc4201acf68 sp=0xc4201acf38 pc=0x4315f5
syscall.Syscall(0xbc, 0xc4204ca780, 0xc420254198, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/syscall/asm_unix_amd64.s:38 +0x67 fp=0xc4201acf70 sp=0xc4201acf68 pc=0x4725d7
syscall.Stat(0xc4204ca700, 0x39, 0xc420254198, 0x39, 0xc4204ca700)
        /usr/local/go/src/syscall/zsyscall_freebsd_amd64.go:1102 +0x97 fp=0xc4201acfe0 sp=0xc4201acf70 pc=0x471957
os.statNolog(0xc4204ca700, 0x39, 0x2, 0x2, 0xc4204ca700, 0x39)
        /usr/local/go/src/os/stat_unix.go:31 +0x5c fp=0xc4201ad030 sp=0xc4201acfe0 pc=0x4937cc
os.Stat(0xc4204ca700, 0x39, 0x2, 0xc4204ca700, 0x39, 0x0)
        /usr/local/go/src/os/stat.go:13 +0x4d fp=0xc4201ad070 sp=0xc4201ad030 pc=0x49329d
cmd/go/internal/base.Tool(0x6f19bc, 0x7, 0x2, 0x0)
        /usr/local/go/src/cmd/go/internal/base/tool.go:38 +0xe4 fp=0xc4201ad120 sp=0xc4201ad070 pc=0x5670d4
cmd/go/internal/work.gcToolchain.gc(0xc420117d60, 0xc420244500, 0xc420317770, 0x23, 0xc4204ec000, 0xe0, 0xeb, 0xc4201ad401, 0xc4200d2000, 0x61, ...)
        /usr/local/go/src/cmd/go/internal/work/gc.go:108 +0x7b5 fp=0xc4201ad420 sp=0xc4201ad120 pc=0x5fcf25
cmd/go/internal/work.(*gcToolchain).gc(0x888500, 0xc420117d60, 0xc420244500, 0xc420317770, 0x23, 0xc4204ec000, 0xe0, 0xeb, 0x1, 0xc4200d2000, ...)
        <autogenerated>:1 +0xdf fp=0xc4201ad4c0 sp=0xc4201ad420 pc=0x615b1f
cmd/go/internal/work.(*Builder).build(0xc420117d60, 0xc420244500, 0x0, 0x0)
        /usr/local/go/src/cmd/go/internal/work/exec.go:574 +0x1a7e fp=0xc4201ade70 sp=0xc4201ad4c0 pc=0x5e619e
cmd/go/internal/work.(*Builder).Do.func1(0xc420244500)
        /usr/local/go/src/cmd/go/internal/work/exec.go:106 +0x72 fp=0xc4201adef8 sp=0xc4201ade70 pc=0x611f42
cmd/go/internal/work.(*Builder).Do.func2(0xc420012ba0, 0xc420117d60, 0xc4202f4ea0)
        /usr/local/go/src/cmd/go/internal/work/exec.go:164 +0xbb fp=0xc4201adfc8 sp=0xc4201adef8 pc=0x61222b
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc4201adfd0 sp=0xc4201adfc8 pc=0x4535f1
created by cmd/go/internal/work.(*Builder).Do
        /usr/local/go/src/cmd/go/internal/work/exec.go:151 +0x38c

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc420012bac)
        /usr/local/go/src/runtime/sema.go:56 +0x39
sync.(*WaitGroup).Wait(0xc420012ba0)
        /usr/local/go/src/sync/waitgroup.go:129 +0x72
cmd/go/internal/work.(*Builder).Do(0xc420117d60, 0xc4204fa000)
        /usr/local/go/src/cmd/go/internal/work/exec.go:173 +0x3b0
cmd/go/internal/work.InstallPackages(0xc42007e050, 0x4, 0x4, 0x0)
        /usr/local/go/src/cmd/go/internal/work/build.go:482 +0xb25
cmd/go/internal/work.runInstall(0x864dc0, 0xc42007e050, 0x4, 0x4)
        /usr/local/go/src/cmd/go/internal/work/build.go:413 +0x49
main.main()
        /usr/local/go/src/cmd/go/main.go:140 +0x7e1

goroutine 19 [syscall]:
os/signal.signal_recv(0x0)
        /usr/local/go/src/runtime/sigqueue.go:139 +0xa6
os/signal.loop()
        /usr/local/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
        /usr/local/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 22 [runnable]:
syscall.Syscall(0x3, 0x9, 0xc4204d2bb8, 0x8, 0x0, 0x8, 0x0)
        /usr/local/go/src/syscall/asm_unix_amd64.s:19 +0x5
syscall.readlen(0x9, 0xc4204d2bb8, 0x8, 0x17, 0xc420146fc0, 0x38)
        /usr/local/go/src/syscall/zsyscall_freebsd_amd64.go:1263 +0x56
syscall.forkExec(0xc4204c4c40, 0x39, 0xc4203f9e40, 0x16, 0x16, 0xc4204d2d30, 0x20, 0x0, 0xc4202c1340)
        /usr/local/go/src/syscall/exec_unix.go:203 +0x419
syscall.StartProcess(0xc4204c4c40, 0x39, 0xc4203f9e40, 0x16, 0x16, 0xc4204d2d30, 0x2, 0x4, 0x0, 0x0)
        /usr/local/go/src/syscall/exec_unix.go:241 +0x64
os.startProcess(0xc4204c4c40, 0x39, 0xc4203f9e40, 0x16, 0x16, 0xc4204d2ed8, 0xc4203d0700, 0x37, 0x37)
        /usr/local/go/src/os/exec_posix.go:46 +0x1f1
os.StartProcess(0xc4204c4c40, 0x39, 0xc4203f9e40, 0x16, 0x16, 0xc4204d2ed8, 0x0, 0x0, 0xc42041a000)
        /usr/local/go/src/os/exec.go:102 +0x7c
os/exec.(*Cmd).Start(0xc420320dc0, 0x75, 0xc420021970)
        /usr/local/go/src/os/exec/exec.go:379 +0x4e6
os/exec.(*Cmd).Run(0xc420320dc0, 0x0, 0x0)
        /usr/local/go/src/os/exec/exec.go:302 +0x2b
cmd/go/internal/work.(*Builder).runOut(0xc420117d60, 0xc42035f7a0, 0x26, 0xc4201c8977, 0x7, 0x0, 0x0, 0x0, 0xc4204f9b80, 0x13, ...)
        /usr/local/go/src/cmd/go/internal/work/exec.go:1516 +0x905
cmd/go/internal/work.gcToolchain.gc(0xc420117d60, 0xc420244c80, 0xc4203bc720, 0x23, 0xc420096e20, 0x10, 0x40, 0xc4204d3400, 0xc42019da90, 0x5, ...)
        /usr/local/go/src/cmd/go/internal/work/gc.go:131 +0xd3a
cmd/go/internal/work.(*Builder).build(0xc420117d60, 0xc420244c80, 0x0, 0x0)
        /usr/local/go/src/cmd/go/internal/work/exec.go:574 +0x1a7e
cmd/go/internal/work.(*Builder).Do.func1(0xc420244c80)
        /usr/local/go/src/cmd/go/internal/work/exec.go:106 +0x72
cmd/go/internal/work.(*Builder).Do.func2(0xc420012ba0, 0xc420117d60, 0xc4202f4ea0)
        /usr/local/go/src/cmd/go/internal/work/exec.go:164 +0xbb
created by cmd/go/internal/work.(*Builder).Do
        /usr/local/go/src/cmd/go/internal/work/exec.go:151 +0x38c
go tool dist: FAILED: /usr/ports/lang/go/work/go/pkg/tool/freebsd_amd64/go_bootstrap install -gcflags=all= -ldflags=all= -i cmd/asm cmd/cgo cmd/compile cmd/link: exit status 2
*** Error code 2

Stop.
make[1]: stopped in /usr/ports/lang/go
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/go

or:

===>  Building for go-1.10.2,1
cd /usr/ports/lang/go/work/go/src &&  GOROOT=/usr/ports/lang/go/work/go GOROOT_FINAL=/usr/local/go  GOROOT_BOOTSTRAP=/usr/local/go14  GOBIN= GOARCH=amd64 GOOS=freebsd  GO386=  /bin/sh make.bash
-ap: not found
Building Go cmd/dist using /usr/local/go14.
Building Go toolchain1 using /usr/local/go14.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
runtime: unexpected return pc for syscall.Syscall called from 0x2
stack: frame={sp:0xc4204d6a48, fp:0xc4204d6a50} stack=[0xc4204d6000,0xc4204d8000)
000000c4204d6948:  000000c4204d6a20  000000000048ce21 <os.startProcess+497> 
000000c4204d6958:  000000c4204ce200  0000000000000035 
000000c4204d6968:  000000c42022c200  0000000000000002 
000000c4204d6978:  0000000000000002  000000c4204d69d8 
000000c4204d6988:  0000000000000002  0000000000000004 
000000c4204d6998:  0000000000000000  0000000000000000 
000000c4204d69a8:  000000000000000d  0000000000000002 
000000c4204d69b8:  0000000000000003  0000000000000000 
000000c4204d69c8:  0000000000000000  000000c42022c2c0 
000000c4204d69d8:  0000000000000000  0000000000000000 
000000c4204d69e8:  000000c420491500  0000000000000037 
000000c4204d69f8:  0000000000000037  000000c4202e23a0 
000000c4204d6a08:  0000000000000003  0000000000000004 
000000c4204d6a18:  0000000000000000  000000c4204d6a78 
000000c4204d6a28:  000000000048c93c <os.StartProcess+124>  000000c4204ce200 
000000c4204d6a38:  0000000000000035  000000c42022c200 
000000c4204d6a48: <0000000000000002 >0000000000000002 
000000c4204d6a58:  000000c4204d6b80  000000c420491500 
000000c4204d6a68:  0000000000000037  0000000000000037 
000000c4204d6a78:  000000c4204d6bc8  00000000004e2466 <os/exec.(*Cmd).Start+1254> 
000000c4204d6a88:  000000c4204ce200  0000000000000035 
000000c4204d6a98:  000000c42022c200  0000000000000002 
000000c4204d6aa8:  0000000000000002  000000c4204d6b80 
000000c4204d6ab8:  0000000000000000  0000000000000000 
000000c4204d6ac8:  0000000000000001  0000000000000002 
000000c4204d6ad8:  0000000000000002  0000000000000002 
000000c4204d6ae8:  0000000000000002  0000000000000004 
000000c4204d6af8:  0000000000000003  000000c42000c098 
000000c4204d6b08:  00000000006f081e  0000000000000004 
000000c4204d6b18:  0000000000000001  000000c4204d6bc0 
000000c4204d6b28:  000000000040f819 <runtime.mallocgc+761>  000000c4200aa2a0 
000000c4204d6b38:  000000c42022c200  000000c4201eca78 
000000c4204d6b48:  000000c4201eca78 
fatal error: unknown caller pc

runtime stack:
runtime.throw(0x6f5ac7, 0x11)
        /usr/local/go/src/runtime/panic.go:616 +0x81
runtime.gentraceback(0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xc4203c8000, 0x0, 0x0, 0x7fffffff, 0xc420047df8, 0x0, 0x0, ...)
        /usr/local/go/src/runtime/traceback.go:257 +0x1bdb
runtime.scanstack(0xc4203c8000, 0xc420023770)
        /usr/local/go/src/runtime/mgcmark.go:786 +0x14b
runtime.scang(0xc4203c8000, 0xc420023770)
        /usr/local/go/src/runtime/proc.go:893 +0x1f6
runtime.markroot.func1()
        /usr/local/go/src/runtime/mgcmark.go:264 +0x6d
runtime.markroot(0xc420023770, 0xc40000000c)
        /usr/local/go/src/runtime/mgcmark.go:245 +0x2f6
runtime.gcDrain(0xc420023770, 0xd)
        /usr/local/go/src/runtime/mgcmark.go:934 +0x111
runtime.gcBgMarkWorker.func2()
        /usr/local/go/src/runtime/mgc.go:1865 +0x187
runtime.systemstack(0x0)
        /usr/local/go/src/runtime/asm_amd64.s:409 +0x79
runtime.mstart()
        /usr/local/go/src/runtime/proc.go:1175

goroutine 6 [GC worker (idle)]:
runtime.systemstack_switch()
        /usr/local/go/src/runtime/asm_amd64.s:363 fp=0xc420033f48 sp=0xc420033f40 pc=0x450c00
runtime.gcBgMarkWorker(0xc420022500)
        /usr/local/go/src/runtime/mgc.go:1829 +0x1ee fp=0xc420033fd8 sp=0xc420033f48 pc=0x41868e
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc420033fe0 sp=0xc420033fd8 pc=0x4535f1
created by runtime.gcBgMarkStartWorkers
        /usr/local/go/src/runtime/mgc.go:1723 +0x79

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc42049d2ec)
        /usr/local/go/src/runtime/sema.go:56 +0x39
sync.(*WaitGroup).Wait(0xc42049d2e0)
        /usr/local/go/src/sync/waitgroup.go:129 +0x72
cmd/go/internal/work.(*Builder).Do(0xc42011da40, 0xc420294f00)
        /usr/local/go/src/cmd/go/internal/work/exec.go:173 +0x3b0
cmd/go/internal/work.InstallPackages(0xc42000e0e0, 0x4, 0x4, 0x0)
        /usr/local/go/src/cmd/go/internal/work/build.go:482 +0xb25
cmd/go/internal/work.runInstall(0x864dc0, 0xc42000e0e0, 0x4, 0x4)
        /usr/local/go/src/cmd/go/internal/work/build.go:413 +0x49
main.main()
        /usr/local/go/src/cmd/go/main.go:140 +0x7e1

goroutine 4 [syscall]:
os/signal.signal_recv(0x0)
        /usr/local/go/src/runtime/sigqueue.go:139 +0xa6
os/signal.loop()
        /usr/local/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
        /usr/local/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 7 [syscall (scan)]:
runtime: unexpected return pc for syscall.Syscall called from 0x2
stack: frame={sp:0xc4204d6a48, fp:0xc4204d6a50} stack=[0xc4204d6000,0xc4204d8000)
000000c4204d6948:  000000c4204d6a20  000000000048ce21 <os.startProcess+497> 
000000c4204d6958:  000000c4204ce200  0000000000000035 
000000c4204d6968:  000000c42022c200  0000000000000002 
000000c4204d6978:  0000000000000002  000000c4204d69d8 
000000c4204d6988:  0000000000000002  0000000000000004 
000000c4204d6998:  0000000000000000  0000000000000000 
000000c4204d69a8:  000000000000000d  0000000000000002 
000000c4204d69b8:  0000000000000003  0000000000000000 
000000c4204d69c8:  0000000000000000  000000c42022c2c0 
000000c4204d69d8:  0000000000000000  0000000000000000 
000000c4204d69e8:  000000c420491500  0000000000000037 
000000c4204d69f8:  0000000000000037  000000c4202e23a0 
000000c4204d6a08:  0000000000000003  0000000000000004 
000000c4204d6a18:  0000000000000000  000000c4204d6a78 
000000c4204d6a28:  000000000048c93c <os.StartProcess+124>  000000c4204ce200 
000000c4204d6a38:  0000000000000035  000000c42022c200 
000000c4204d6a48: <0000000000000002 >0000000000000002 
000000c4204d6a58:  000000c4204d6b80  000000c420491500 
000000c4204d6a68:  0000000000000037  0000000000000037 
000000c4204d6a78:  000000c4204d6bc8  00000000004e2466 <os/exec.(*Cmd).Start+1254> 
000000c4204d6a88:  000000c4204ce200  0000000000000035 
000000c4204d6a98:  000000c42022c200  0000000000000002 
000000c4204d6aa8:  0000000000000002  000000c4204d6b80 
000000c4204d6ab8:  0000000000000000  0000000000000000 
000000c4204d6ac8:  0000000000000001  0000000000000002 
000000c4204d6ad8:  0000000000000002  0000000000000002 
000000c4204d6ae8:  0000000000000002  0000000000000004 
000000c4204d6af8:  0000000000000003  000000c42000c098 
000000c4204d6b08:  00000000006f081e  0000000000000004 
000000c4204d6b18:  0000000000000001  000000c4204d6bc0 
000000c4204d6b28:  000000000040f819 <runtime.mallocgc+761>  000000c4200aa2a0 
000000c4204d6b38:  000000c42022c200  000000c4201eca78 
000000c4204d6b48:  000000c4201eca78 
syscall.Syscall(0x2, 0xc4204d6b80, 0xc420491500, 0x37, 0x37, 0xc4204d6bc8, 0x4e2466)
        /usr/local/go/src/syscall/asm_unix_amd64.s:19 +0x5
created by cmd/go/internal/work.(*Builder).Do
        /usr/local/go/src/cmd/go/internal/work/exec.go:151 +0x38c

goroutine 8 [runnable]:
cmd/go/internal/work.(*Builder).buildActionID(0xc42011da40, 0xc4203a4500, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/cmd/go/internal/work/exec.go:286 +0x89d
cmd/go/internal/work.(*Builder).build(0xc42011da40, 0xc4203a4500, 0x0, 0x0)
        /usr/local/go/src/cmd/go/internal/work/exec.go:304 +0xb0
cmd/go/internal/work.(*Builder).Do.func1(0xc4203a4500)
        /usr/local/go/src/cmd/go/internal/work/exec.go:106 +0x72
cmd/go/internal/work.(*Builder).Do.func2(0xc42049d2e0, 0xc42011da40, 0xc42041a0a0)
        /usr/local/go/src/cmd/go/internal/work/exec.go:164 +0xbb
created by cmd/go/internal/work.(*Builder).Do
        /usr/local/go/src/cmd/go/internal/work/exec.go:151 +0x38c
go tool dist: FAILED: /usr/ports/lang/go/work/go/pkg/tool/freebsd_amd64/go_bootstrap install -gcflags=all= -ldflags=all= -i cmd/asm cmd/cgo cmd/compile cmd/link: exit status 2
*** Error code 2

Stop.
make[1]: stopped in /usr/ports/lang/go
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/go

or

===>  Building for go-1.10.2,1
cd /usr/ports/lang/go/work/go/src &&  GOROOT=/usr/ports/lang/go/work/go GOROOT_FINAL=/usr/local/go  GOROOT_BOOTSTRAP=/usr/local/go14  GOBIN= GOARCH=amd64 GOOS=freebsd  GO386=  /bin/sh make.bash
-ap: not found
Building Go cmd/dist using /usr/local/go14.
Building Go toolchain1 using /usr/local/go14.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
runtime: newstack sp=0xc420041e68 stack=[0xc42019e000, 0xc4201a0000]
        morebuf={pc:0x41c851 sp:0xc420041e78 lr:0x0}
        sched={pc:0x411a41 sp:0xc420041e70 lr:0x0 ctxt:0x0}
runtime: gp=0xc420418000, gp->status=0x4
 runtime: split stack overflow: 0xc420041e68 < 0xc42019e000
fatal error: runtime: split stack overflow

runtime stack:
runtime.throw(0x6fa4d8, 0x1d)
        /usr/local/go/src/runtime/panic.go:616 +0x81
runtime.newstack()
        /usr/local/go/src/runtime/stack.go:1005 +0x862
runtime.morestack()
        /usr/local/go/src/runtime/asm_amd64.s:480 +0x89

goroutine 19 [GC assist marking]:
runtime.heapBitsForObject(0xc420316520, 0xc42031c000, 0x0, 0x411a41, 0x0, 0xc420041e78, 0x41c851, 0xc4201a0000)
        /usr/local/go/src/runtime/mbitmap.go:383 +0x481 fp=0xc420041e78 sp=0xc420041e70 pc=0x411a41
runtime: unexpected return pc for runtime.scanobject called from 0xc420041e78
stack: frame={sp:0xc420041e78, fp:0xc420041f20} stack=[0xc42019e000,0xc4201a0000)

runtime.scanobject(0x41c851, 0xc420418000)
        /usr/local/go/src/runtime/mgcmark.go:1209 +0x251 fp=0xc420041f20 sp=0xc420041e78 pc=0x41c851
created by cmd/go/internal/work.(*Builder).Do
        /usr/local/go/src/cmd/go/internal/work/exec.go:151 +0x38c

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc4203e0d4c)
        /usr/local/go/src/runtime/sema.go:56 +0x39
sync.(*WaitGroup).Wait(0xc4203e0d40)
        /usr/local/go/src/sync/waitgroup.go:129 +0x72
cmd/go/internal/work.(*Builder).Do(0xc4203d37c0, 0xc4204f2000)
        /usr/local/go/src/cmd/go/internal/work/exec.go:173 +0x3b0
cmd/go/internal/work.InstallPackages(0xc42000e0e0, 0x4, 0x4, 0x0)
        /usr/local/go/src/cmd/go/internal/work/build.go:482 +0xb25
cmd/go/internal/work.runInstall(0x864dc0, 0xc42000e0e0, 0x4, 0x4)
        /usr/local/go/src/cmd/go/internal/work/build.go:413 +0x49
main.main()
        /usr/local/go/src/cmd/go/main.go:140 +0x7e1

goroutine 4 [syscall]:
os/signal.signal_recv(0x0)
        /usr/local/go/src/runtime/sigqueue.go:139 +0xa6
os/signal.loop()
        /usr/local/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
        /usr/local/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 18 [syscall]:
syscall.Syscall6(0x214, 0x0, 0xc7e1, 0x0, 0x18, 0x0, 0x0, 0xc42047af20, 0x4e255f, 0x10)
        /usr/local/go/src/syscall/asm_unix_amd64.s:42 +0x5
os.(*Process).blockUntilWaitable(0xc42028a690, 0x0, 0x0, 0x14)
        /usr/local/go/src/os/wait_wait6.go:29 +0x5e
os.(*Process).wait(0xc42028a690, 0xc4204f23c0, 0xc42020ebd8, 0xc42020ebd8)
        /usr/local/go/src/os/exec_unix.go:22 +0x3c
os.(*Process).Wait(0xc42028a690, 0x713e58, 0x713e60, 0x713e50)
        /usr/local/go/src/os/exec.go:123 +0x2b
os/exec.(*Cmd).Wait(0xc42020eb00, 0x0, 0x0)
        /usr/local/go/src/os/exec/exec.go:461 +0x5c
os/exec.(*Cmd).Run(0xc42020eb00, 0x0, 0x0)
        /usr/local/go/src/os/exec/exec.go:305 +0x5c
cmd/go/internal/work.(*Builder).runOut(0xc4203d37c0, 0xc420277860, 0x2a, 0xc4201bfa01, 0xb, 0x0, 0x0, 0x0, 0xc4204f2280, 0x12, ...)
        /usr/local/go/src/cmd/go/internal/work/exec.go:1516 +0x905
cmd/go/internal/work.gcToolchain.gc(0xc4203d37c0, 0xc4203be780, 0xc420240210, 0x23, 0xc4200aa640, 0x10, 0x40, 0xc42047b401, 0xc420396ae0, 0x2, ...)
        /usr/local/go/src/cmd/go/internal/work/gc.go:131 +0xd3a
cmd/go/internal/work.(*Builder).build(0xc4203d37c0, 0xc4203be780, 0x0, 0x0)
        /usr/local/go/src/cmd/go/internal/work/exec.go:574 +0x1a7e
cmd/go/internal/work.(*Builder).Do.func1(0xc4203be780)
        /usr/local/go/src/cmd/go/internal/work/exec.go:106 +0x72
cmd/go/internal/work.(*Builder).Do.func2(0xc4203e0d40, 0xc4203d37c0, 0xc4204d6e60)
        /usr/local/go/src/cmd/go/internal/work/exec.go:164 +0xbb
created by cmd/go/internal/work.(*Builder).Do
        /usr/local/go/src/cmd/go/internal/work/exec.go:151 +0x38c

goroutine 25 [IO wait]:
internal/poll.runtime_pollWait(0x800903d60, 0x72, 0xc420035ce8)
        /usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4204d0568, 0x72, 0xffffffffffffff01, 0x739600, 0x84d2a8)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0x9b
internal/poll.(*pollDesc).waitRead(0xc4204d0568, 0xc420295001, 0x200, 0x200)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc4204d0550, 0xc420295000, 0x200, 0x200, 0x0, 0x0, 0x0)
        /usr/local/go/src/internal/poll/fd_unix.go:157 +0x17d
os.(*File).read(0xc42000c270, 0xc420295000, 0x200, 0x200, 0xc420295000, 0x0, 0x0)
        /usr/local/go/src/os/file_unix.go:226 +0x4e
os.(*File).Read(0xc42000c270, 0xc420295000, 0x200, 0x200, 0xc420035e58, 0x487b3c, 0xc420035e60)
        /usr/local/go/src/os/file.go:107 +0x6a
bytes.(*Buffer).ReadFrom(0xc4200aa690, 0x7391e0, 0xc42000c270, 0x8008c7a00, 0xc4200aa690, 0xc420035e01)
        /usr/local/go/src/bytes/buffer.go:205 +0xa0
io.copyBuffer(0x738d00, 0xc4200aa690, 0x7391e0, 0xc42000c270, 0x0, 0x0, 0x0, 0xc4204dd810, 0x0, 0x0)
        /usr/local/go/src/io/io.go:386 +0x31a
io.Copy(0x738d00, 0xc4200aa690, 0x7391e0, 0xc42000c270, 0x402f75, 0xc4203b84e0, 0xc420035fb0)
        /usr/local/go/src/io/io.go:362 +0x5a
os/exec.(*Cmd).writerDescriptor.func1(0xc4203b84e0, 0xc420035fb0)
        /usr/local/go/src/os/exec/exec.go:275 +0x4d
os/exec.(*Cmd).Start.func1(0xc42020eb00, 0xc420396bc0)
        /usr/local/go/src/os/exec/exec.go:396 +0x27
created by os/exec.(*Cmd).Start
        /usr/local/go/src/os/exec/exec.go:395 +0x5df
go tool dist: FAILED: /usr/ports/lang/go/work/go/pkg/tool/freebsd_amd64/go_bootstrap install -gcflags=all= -ldflags=all= -i cmd/asm cmd/cgo cmd/compile cmd/link: exit status 2
*** Error code 2

Stop.
make[1]: stopped in /usr/ports/lang/go
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/go

or

===>  Building for go-1.10.2,1
cd /usr/ports/lang/go/work/go/src &&  GOROOT=/usr/ports/lang/go/work/go GOROOT_FINAL=/usr/local/go  GOROOT_BOOTSTRAP=/usr/local/go14  GOBIN= GOARCH=amd64 GOOS=freebsd  GO386=  /bin/sh make.bash
-ap: not found
Building Go cmd/dist using /usr/local/go14.
Building Go toolchain1 using /usr/local/go14.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
acquirep: p->m=842351962112(4) p->status=1
fatal error: acquirep: invalid p state

runtime stack:
runtime.throw(0x6f8a35, 0x19)
        /usr/local/go/src/runtime/panic.go:616 +0x81
runtime.acquirep1(0xc420020000)
        /usr/local/go/src/runtime/proc.go:4066 +0x159
runtime.acquirep(0xc420020000)
        /usr/local/go/src/runtime/proc.go:4038 +0x2b
runtime.stopm()
        /usr/local/go/src/runtime/proc.go:1963 +0x124
runtime.findrunnable(0xc420020000, 0x0)
        /usr/local/go/src/runtime/proc.go:2415 +0x50c
runtime.schedule()
        /usr/local/go/src/runtime/proc.go:2541 +0x13b
runtime.park_m(0xc420064480)
        /usr/local/go/src/runtime/proc.go:2604 +0xb6
runtime.mcall(0x4535f1)
        /usr/local/go/src/runtime/asm_amd64.s:351 +0x5b

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc4203bad2c)
        /usr/local/go/src/runtime/sema.go:56 +0x39
sync.(*WaitGroup).Wait(0xc4203bad20)
        /usr/local/go/src/sync/waitgroup.go:129 +0x72
cmd/go/internal/work.(*Builder).Do(0xc42012f900, 0xc4204f0000)
        /usr/local/go/src/cmd/go/internal/work/exec.go:173 +0x3b0
cmd/go/internal/work.InstallPackages(0xc42007e050, 0x4, 0x4, 0x0)
        /usr/local/go/src/cmd/go/internal/work/build.go:482 +0xb25
cmd/go/internal/work.runInstall(0x864dc0, 0xc42007e050, 0x4, 0x4)
        /usr/local/go/src/cmd/go/internal/work/build.go:413 +0x49
main.main()
        /usr/local/go/src/cmd/go/main.go:140 +0x7e1

goroutine 19 [syscall]:
os/signal.signal_recv(0x0)
        /usr/local/go/src/runtime/sigqueue.go:139 +0xa6
os/signal.loop()
        /usr/local/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
        /usr/local/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 21 [semacquire]:
sync.runtime_SemacquireMutex(0x8885e4, 0x0)
        /usr/local/go/src/runtime/sema.go:71 +0x3d
sync.(*Mutex).Lock(0x8885e0)
        /usr/local/go/src/sync/mutex.go:134 +0x108
sync.(*RWMutex).Lock(0x8885e0)
        /usr/local/go/src/sync/rwmutex.go:93 +0x2d
syscall.forkExec(0xc420550240, 0x35, 0xc4202ea1c0, 0x2, 0x2, 0xc42024c9d8, 0x20, 0x0, 0xc4204e6380)
        /usr/local/go/src/syscall/exec_unix.go:186 +0x253
syscall.StartProcess(0xc420550240, 0x35, 0xc4202ea1c0, 0x2, 0x2, 0xc42024c9d8, 0x2, 0x4, 0x0, 0x0)
        /usr/local/go/src/syscall/exec_unix.go:241 +0x64
os.startProcess(0xc420550240, 0x35, 0xc4202ea1c0, 0x2, 0x2, 0xc42024cb80, 0xc42027b500, 0x37, 0x37)
        /usr/local/go/src/os/exec_posix.go:46 +0x1f1
os.StartProcess(0xc420550240, 0x35, 0xc4202ea1c0, 0x2, 0x2, 0xc42024cb80, 0x0, 0x0, 0x1)
        /usr/local/go/src/os/exec.go:102 +0x7c
os/exec.(*Cmd).Start(0xc42047e000, 0x6f0801, 0xc4200ba2a0)
        /usr/local/go/src/os/exec/exec.go:379 +0x4e6
os/exec.(*Cmd).Run(0xc42047e000, 0xc4200ba2a0, 0xc42027aa80)
        /usr/local/go/src/os/exec/exec.go:302 +0x2b
cmd/go/internal/work.(*Builder).toolID(0xc42012f900, 0x6f04de, 0x3, 0x11, 0xc42024d2f0)
        /usr/local/go/src/cmd/go/internal/work/buildid.go:183 +0x321
cmd/go/internal/work.(*Builder).buildActionID(0xc42012f900, 0xc4201cf540, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/cmd/go/internal/work/exec.go:221 +0x16e5
cmd/go/internal/work.(*Builder).build(0xc42012f900, 0xc4201cf540, 0x0, 0x0)
        /usr/local/go/src/cmd/go/internal/work/exec.go:304 +0xb0
cmd/go/internal/work.(*Builder).Do.func1(0xc4201cf540)
        /usr/local/go/src/cmd/go/internal/work/exec.go:106 +0x72
cmd/go/internal/work.(*Builder).Do.func2(0xc4203bad20, 0xc42012f900, 0xc420496e60)
        /usr/local/go/src/cmd/go/internal/work/exec.go:164 +0xbb
created by cmd/go/internal/work.(*Builder).Do
        /usr/local/go/src/cmd/go/internal/work/exec.go:151 +0x38c

goroutine 22 [syscall]:
syscall.Syscall6(0x214, 0x0, 0xc8d8, 0x0, 0x18, 0x0, 0x0, 0xc4201a8f20, 0x4e255f, 0x10)
        /usr/local/go/src/syscall/asm_unix_amd64.s:42 +0x5
os.(*Process).blockUntilWaitable(0xc42001a9f0, 0x0, 0x0, 0x12)
        /usr/local/go/src/os/wait_wait6.go:29 +0x5e
os.(*Process).wait(0xc42001a9f0, 0xc4201d4120, 0xc42044d838, 0xc42044d838)
        /usr/local/go/src/os/exec_unix.go:22 +0x3c
os.(*Process).Wait(0xc42001a9f0, 0x713e58, 0x713e60, 0x713e50)
        /usr/local/go/src/os/exec.go:123 +0x2b
os/exec.(*Cmd).Wait(0xc42044d760, 0x0, 0x0)
        /usr/local/go/src/os/exec/exec.go:461 +0x5c
os/exec.(*Cmd).Run(0xc42044d760, 0x0, 0x0)
        /usr/local/go/src/os/exec/exec.go:305 +0x5c
cmd/go/internal/work.(*Builder).runOut(0xc42012f900, 0xc42001b7a0, 0x25, 0xc420012e59, 0x6, 0x0, 0x0, 0x0, 0xc420378dc0, 0xf, ...)
        /usr/local/go/src/cmd/go/internal/work/exec.go:1516 +0x905
cmd/go/internal/work.gcToolchain.gc(0xc42012f900, 0xc4201cec80, 0xc42001a570, 0x23, 0xc420096f00, 0x10, 0x40, 0xc4201a9400, 0xc42006cda0, 0x1, ...)
        /usr/local/go/src/cmd/go/internal/work/gc.go:131 +0xd3a
cmd/go/internal/work.(*Builder).build(0xc42012f900, 0xc4201cec80, 0x0, 0x0)
        /usr/local/go/src/cmd/go/internal/work/exec.go:574 +0x1a7e
cmd/go/internal/work.(*Builder).Do.func1(0xc4201cec80)
        /usr/local/go/src/cmd/go/internal/work/exec.go:106 +0x72
cmd/go/internal/work.(*Builder).Do.func2(0xc4203bad20, 0xc42012f900, 0xc420496e60)
        /usr/local/go/src/cmd/go/internal/work/exec.go:164 +0xbb
created by cmd/go/internal/work.(*Builder).Do
        /usr/local/go/src/cmd/go/internal/work/exec.go:151 +0x38c

goroutine 25 [runnable]:
os/exec.(*Cmd).Start.func1(0xc42044d760, 0xc420497120)
        /usr/local/go/src/os/exec/exec.go:395
created by os/exec.(*Cmd).Start
        /usr/local/go/src/os/exec/exec.go:395 +0x5df
go tool dist: FAILED: /usr/ports/lang/go/work/go/pkg/tool/freebsd_amd64/go_bootstrap install -gcflags=all= -ldflags=all= -i cmd/asm cmd/cgo cmd/compile cmd/link: exit status 2
*** Error code 2

Stop.
make[1]: stopped in /usr/ports/lang/go
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/go
@tzdybal

This comment has been minimized.

tzdybal commented Jun 11, 2018

After installing compat6x-amd64 my problem is solved - default installation of go works.

UPDATE: it works sometimes, but sometimes I still see the crash.

@artooro

This comment has been minimized.

artooro commented Jun 12, 2018

That package isn't even available on ARM, I think your issue is unrelated to this issue which is specific to compiling the Go tools in ARM under poudriere/qemu.

@mvdan

This comment has been minimized.

Member

mvdan commented Jun 29, 2018

Just encountered #26141, which might be related. I conservatively created a new issue, since they don't look to be the exact same issue to me.

@ianlancetaylor

This comment has been minimized.

Contributor

ianlancetaylor commented Jul 10, 2018

@artooro Since it works on normal FreeBSD/ARM but fails on QEMU, I would look closely at the definition of struct kevent used by QEMU's implementation of kqueue. For example, OpenBSD seems to make the data field int64 where FreeBSD makes it int32. If QEMU is using int64, that could cause this problem.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.12 Jul 10, 2018

@paulzhol

This comment has been minimized.

Member

paulzhol commented Aug 24, 2018

FYI as of a couple of months ago the FreeBSD/ARM builder is running under QEMU with KVM acceleration (using the ARMv7 virtualization extensions - details here).

This is different from qemu-arm-static which is "QEMU User Mode". As Ian notes there might be bugs in the user qemu code translating the system calls, especially with the host being 64-bit while the ARM ABI it's emulating is 32-bit.

@aclements

This comment has been minimized.

Member

aclements commented Aug 24, 2018

@artooro, sorry if I missed this somewhere, but what is the host architecture you're running on (outside of the qemu emulation)? Is it also ARM or something else?

In particular, QEMU doesn't have any special handling for kqueue. It just passes the syscall unmodified to the host (bsd-user/syscall.c:do_freebsd_syscall). If the QEMU host is 64-bit, then QEMU will wind up passing a pointer to a 32-bit kevent structure to the host kernel, which expects a pointer to a 64-bit kevent structure. The two structures are laid out differently, so this could lead to crashes.

@artooro

This comment has been minimized.

artooro commented Aug 24, 2018

@aclements I've tested on multiple host machines, all were 64-bit Intel. I don't have an ARM host machine to test with.

It sounds like if I used a 32-bit host, it might work from what you're saying. Perhaps I'll install 32-bit freebsd in a VM to test.

@aclements

This comment has been minimized.

Member

aclements commented Aug 24, 2018

That would be an interesting test. kevent, at least, is the same between freebsd/386 and freebsd/arm. It looks like a few other structures disagree, but they're all related to time, so maybe those don't matter as much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment