Repository: go
Issue: runtime: unexpected signal on Termux android/arm64
Labels: NeedsInvestigation,compiler/runtime

<!-- Please answer these questions before submitting your issue. Thanks! -->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.11.4 android/arm64
</pre>

### Does this issue reproduce with the latest release?
Yes


### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GOARCH="arm64"
GOBIN=""
GOCACHE="/data/data/com.termux/files/home/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="android"
GOOS="android"
GOPATH="/data/data/com.termux/files/home/go"
GOPROXY=""
GORACE=""
GOROOT="/data/data/com.termux/files/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/data/data/com.termux/files/usr/lib/go/pkg/tool/android_arm64"
GCCGO="gccgo"
CC="aarch64-linux-android-clang"
CXX="aarch64-linux-android-clang++"
CGO_ENABLED="1"
GOMOD="/data/data/com.termux/files/home/storage/shared/dev/projects/playground/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="/home/builder/.termux-build/_cache/18-aarch64-21-v1/bin/aarch64-linux-android-pkg-config"
GOGCCFLAGS="-fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/data/data/com.termux/files/usr/tmp/go-build261125908=/tmp/go-build -gno-record-gcc-switches"

</pre></details>

### What did you do?

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->
I create project outside the gopath using go mod
```
go mod init github.com/uudashr/playground
```

and have this files `doc.go` and `hello_test.go`
```go
package playground_test

import "testing"

func TestHello(t *testing.T) {
  // Do nothing
}
```

then run test
```
go test
```
### What did you expect to see?
Always shows
```
PASS
ok  	github.com/uudashr/playground	0.038s
```


### What did you see instead?
1 out of 10 stuck/hung

and

1 out of 10 shows

```
PASS
ok  	github.com/uudashr/playground	0.033s
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x64 pc=0x7e1195d20]

runtime stack:
runtime.throw(0x7e154c90f, 0x2a)
	/data/data/com.termux/files/usr/lib/go/src/runtime/panic.go:608 +0x4c
runtime.sigpanic()
	/data/data/com.termux/files/usr/lib/go/src/runtime/signal_unix.go:374 +0x2a4
runtime.markrootSpans(0x4000031270, 0x0)
	/data/data/com.termux/files/usr/lib/go/src/runtime/mgcmark.go:357 +0x88
runtime.markroot(0x4000031270, 0x200000004)
	/data/data/com.termux/files/usr/lib/go/src/runtime/mgcmark.go:225 +0x340
runtime.gcDrain(0x4000031270, 0xd)
	/data/data/com.termux/files/usr/lib/go/src/runtime/mgcmark.go:882 +0x108
runtime.gcBgMarkWorker.func2()
	/data/data/com.termux/files/usr/lib/go/src/runtime/mgc.go:1862 +0x16c
runtime.systemstack(0x73ca02f400)
	/data/data/com.termux/files/usr/lib/go/src/runtime/asm_arm64.s:230 +0x90
runtime.mstart()
	/data/data/com.termux/files/usr/lib/go/src/runtime/proc.go:1229

goroutine 50 [GC worker (idle)]:
runtime.systemstack_switch()
	/data/data/com.termux/files/usr/lib/go/src/runtime/asm_arm64.s:178 +0x8 fp=0x40002d6f50 sp=0x40002d6f40 pc=0x7e11ca290
runtime.gcBgMarkWorker(0x4000030000)
	/data/data/com.termux/files/usr/lib/go/src/runtime/mgc.go:1826 +0x198 fp=0x40002d6fd0 sp=0x40002d6f50 pc=0x7e1193ae0
runtime.goexit()
	/data/data/com.termux/files/usr/lib/go/src/runtime/asm_arm64.s:1114 +0x4 fp=0x40002d6fd0 sp=0x40002d6fd0 pc=0x7e11cca0c
created by runtime.gcBgMarkStartWorkers
	/data/data/com.termux/files/usr/lib/go/src/runtime/mgc.go:1720 +0x70

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0x4000253a38)
	/data/data/com.termux/files/usr/lib/go/src/runtime/sema.go:56 +0x2c
sync.(*WaitGroup).Wait(0x4000253a30)
	/data/data/com.termux/files/usr/lib/go/src/sync/waitgroup.go:130 +0x64
cmd/go/internal/work.(*Builder).Do(0x40003e6280, 0x40003d3540)
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:174 +0x31c
cmd/go/internal/test.runTest(0x7e1aef420, 0x400000e070, 0x0, 0x0)
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/test/test.go:759 +0xcd8
main.main()
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/main.go:219 +0x6e8

goroutine 5 [syscall]:
os/signal.signal_recv(0x4000000000)
	/data/data/com.termux/files/usr/lib/go/src/runtime/sigqueue.go:139 +0xb8
os/signal.loop()
	/data/data/com.termux/files/usr/lib/go/src/os/signal/signal_unix.go:23 +0x18
created by os/signal.init.0
	/data/data/com.termux/files/usr/lib/go/src/os/signal/signal_unix.go:29 +0x30

goroutine 68 [select]:
cmd/go/internal/work.(*Builder).Do.func2(0x4000253a30, 0x40003e6280, 0x400059b2c0)
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:155 +0xdc
created by cmd/go/internal/work.(*Builder).Do
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:152 +0x2f8

goroutine 69 [select]:
cmd/go/internal/work.(*Builder).Do.func2(0x4000253a30, 0x40003e6280, 0x400059b2c0)
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:155 +0xdc
created by cmd/go/internal/work.(*Builder).Do
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:152 +0x2f8

goroutine 60 [chan receive]:
cmd/go/internal/base.processSignals.func1(0x400002c960)
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/base/signal.go:21 +0x24
created by cmd/go/internal/base.processSignals
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/base/signal.go:20 +0x78

goroutine 70 [select]:
cmd/go/internal/work.(*Builder).Do.func2(0x4000253a30, 0x40003e6280, 0x400059b2c0)
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:155 +0xdc
created by cmd/go/internal/work.(*Builder).Do
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:152 +0x2f8

goroutine 71 [select]:
cmd/go/internal/work.(*Builder).Do.func2(0x4000253a30, 0x40003e6280, 0x400059b2c0)
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:155 +0xdc
created by cmd/go/internal/work.(*Builder).Do
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:152 +0x2f8

goroutine 72 [runnable]:
syscall.Syscall(0x23, 0xffffffffffffff9c, 0x400043a280, 0x0, 0x0, 0x400043a280, 0x0)
	/data/data/com.termux/files/usr/lib/go/src/syscall/asm_linux_arm64.s:9 +0x8
syscall.unlinkat(0xffffffffffffff9c, 0x400043a1e0, 0x4a, 0x0, 0x0, 0x400043a1e0)
	/data/data/com.termux/files/usr/lib/go/src/syscall/zsyscall_linux_arm64.go:126 +0x68
syscall.Unlink(0x400043a1e0, 0x4a, 0x4a, 0x400043a1e0)
	/data/data/com.termux/files/usr/lib/go/src/syscall/syscall_linux.go:168 +0x34
os.Remove(0x400043a1e0, 0x4a, 0xe, 0x4a)
	/data/data/com.termux/files/usr/lib/go/src/os/file_unix.go:306 +0x28
os.RemoveAll(0x400043a1e0, 0x4a, 0x3b, 0x7e1535c2e)
	/data/data/com.termux/files/usr/lib/go/src/os/path.go:68 +0x28
os.RemoveAll(0x400033b4c0, 0x3b, 0x40000e8ca8, 0x7e1472198)
	/data/data/com.termux/files/usr/lib/go/src/os/path.go:109 +0x390
cmd/go/internal/test.builderCleanTest(0x40003e6280, 0x40000c4780, 0x40003e62f0, 0x7e1762840)
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/test/test.go:1603 +0x4c
cmd/go/internal/work.(*Builder).Do.func1(0x40000c4780)
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:107 +0x50
cmd/go/internal/work.(*Builder).Do.func2(0x4000253a30, 0x40003e6280, 0x400059b2c0)
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:165 +0x8c
created by cmd/go/internal/work.(*Builder).Do
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:152 +0x2f8

goroutine 73 [select]:
cmd/go/internal/work.(*Builder).Do.func2(0x4000253a30, 0x40003e6280, 0x400059b2c0)
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:155 +0xdc
created by cmd/go/internal/work.(*Builder).Do
	/data/data/com.termux/files/usr/lib/go/src/cmd/go/internal/work/exec.go:152 +0x2f8
```