Repository: go
Issue: os: occasional TestProgWideChdir deadlocks on arm builders
Labels: Testing,NeedsInvestigation

Possibly the same root cause as #29633 (CC @ianlancetaylor).
Two different failure modes, but the same test on the stack both times.

https://build.golang.org/log/e01b6ffb1a8fd323903ae672f43a6b086b8d217f

<details>

```
SIGQUIT: quit
PC=0x6c8c8 m=3 sigcode=0

goroutine 6 [syscall]:
runtime.notetsleepg(0x2b6408, 0xffffffff, 0xffffffff, 0x1)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/runtime/lock_sema.go:286 +0x24 fp=0x42cfc8 sp=0x42cfa4 pc=0x19ec0
os/signal.signal_recv(0x0)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/runtime/sigqueue.go:139 +0x130 fp=0x42cfe0 sp=0x42cfc8 pc=0x54894
os/signal.loop()
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/signal/signal_unix.go:23 +0x14 fp=0x42cfec sp=0x42cfe0 pc=0x114cfc
runtime.goexit()
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/runtime/asm_arm.s:868 +0x4 fp=0x42cfec sp=0x42cfec pc=0x6bad4
created by os/signal.init.0
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/signal/signal_unix.go:29 +0x30

goroutine 1 [chan receive]:
testing.(*T).Run(0x47fae0, 0x18e070, 0x11, 0x199074, 0x1)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/testing/testing.go:961 +0x2cc
testing.runTests.func1(0x47e000)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/testing/testing.go:1207 +0x68
testing.tRunner(0x47e000, 0x42a710)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/testing/testing.go:909 +0xa0
testing.runTests(0x40c090, 0x2a4a50, 0x7b, 0x7b, 0x0)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/testing/testing.go:1205 +0x238
testing.(*M).Run(0x440100, 0x0)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/testing/testing.go:1122 +0x130
main.main()
	_testmain.go:318 +0x120

goroutine 51 [runnable]:
os_test.TestProgWideChdir(0x47fae0)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1317 +0x35c
testing.tRunner(0x47fae0, 0x199074)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/testing/testing.go:909 +0xa0
created by testing.(*T).Run
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/testing/testing.go:960 +0x2ac

goroutine 56 [runnable]:
os_test.TestProgWideChdir.func1(0x50e880, 0x47fae0, 0x50e8c0, 0x4)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1272
created by os_test.TestProgWideChdir
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1272 +0x80

goroutine 57 [runnable]:
os_test.TestProgWideChdir.func1(0x50e880, 0x47fae0, 0x50e8c0, 0x5)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1272
created by os_test.TestProgWideChdir
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1272 +0x80

goroutine 58 [runnable]:
os_test.TestProgWideChdir.func1(0x50e880, 0x47fae0, 0x50e8c0, 0x6)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1272
created by os_test.TestProgWideChdir
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1272 +0x80

goroutine 59 [runnable]:
os_test.TestProgWideChdir.func1(0x50e880, 0x47fae0, 0x50e8c0, 0x7)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1272
created by os_test.TestProgWideChdir
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1272 +0x80

goroutine 60 [runnable]:
os_test.TestProgWideChdir.func1(0x50e880, 0x47fae0, 0x50e8c0, 0x8)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1272
created by os_test.TestProgWideChdir
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1272 +0x80

goroutine 61 [runnable]:
runtime.LockOSThread()
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/runtime/proc.go:3530 +0x5c
os_test.TestProgWideChdir.func1(0x50e880, 0x47fae0, 0x50e8c0, 0x9)
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1281 +0x124
created by os_test.TestProgWideChdir
	/home/gopher/build/openbsd-arm-46fd677069df/go/src/os/os_test.go:1272 +0x80

trap    0x0
error   0x0
oldmask 0x0
r0      0x58
r1      0x3
r2      0x0
r3      0x0
r4      0x42e58c
r5      0x1
r6      0x0
r7      0x199300
r8      0x7
r9      0x1
r10     0x400e00
fp      0xffffffc0
ip      0x5e
sp      0x42cf50
lr      0x3b618
pc      0x6c8c8
cpsr    0x40000010
fault   0x0
*** Test killed with quit: ran too long (37m0s).
FAIL	os	2220.201s
```

</details><br>

https://build.golang.org/log/7b59d0589251c325136e98f4b76193ae919399b4

<details>

```
SIGQUIT: quit
PC=0x6c974 m=5 sigcode=0

goroutine 0 [idle]:
runtime: unexpected return pc for runtime.kevent called from 0x40
stack: frame={sp:0x4d96f4, fp:0x4d96fc} stack=[0x4d8000,0x4da000)
004d9674:  00000000  00000000  00000000  00000000 
004d9684:  00000000  00000000  00000000  00000000 
004d9694:  00000000  00000000  00000000  00000000 
004d96a4:  00000000  00000000  00000000  00000000 
004d96b4:  00000000  00000000  00000000  00000000 
004d96c4:  00000000  00000000  00000000  00000000 
004d96d4:  00000000  00000000  00000000  00000000 
004d96e4:  00000000  00000000  00000000  0003b294 <runtime.netpoll+376> 
004d96f4: <00000040  00000000 >000448c4 <runtime.findrunnable+960>  00000005 
004d9704:  00000000  00000000  004d973c  00000040 
004d9714:  00000000  00000000  00000000  00000000 
004d9724:  00000000  00000000  00000000  00000000 
004d9734:  00000000  00000000  00000000  00000000 
004d9744:  00000000  00000000  00000000  00000000 
004d9754:  00000000  00000000  00000000  00000000 
004d9764:  00000000  00000000  00000000  00000000 
004d9774:  00000000  00000000 
runtime.kevent(0x5, 0x0, 0x0, 0x4d973c, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/runtime/sys_openbsd_arm.s:357 +0x30

goroutine 1 [chan receive]:
testing.(*T).Run(0x47fae0, 0x18e070, 0x11, 0x199074, 0x1)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/testing/testing.go:961 +0x2cc
testing.runTests.func1(0x47e000)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/testing/testing.go:1207 +0x68
testing.tRunner(0x47e000, 0x42a710)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/testing/testing.go:909 +0xa0
testing.runTests(0x40c090, 0x2a4a50, 0x7b, 0x7b, 0x0)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/testing/testing.go:1205 +0x238
testing.(*M).Run(0x440100, 0x0)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/testing/testing.go:1122 +0x130
main.main()
	_testmain.go:318 +0x120

goroutine 6 [syscall]:
os/signal.signal_recv(0x0)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/runtime/sigqueue.go:139 +0x130
os/signal.loop()
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/signal/signal_unix.go:23 +0x14
created by os/signal.init.0
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/signal/signal_unix.go:29 +0x30

goroutine 51 [runnable]:
os_test.TestProgWideChdir(0x47fae0)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1317 +0x35c
testing.tRunner(0x47fae0, 0x199074)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/testing/testing.go:909 +0xa0
created by testing.(*T).Run
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/testing/testing.go:960 +0x2ac

goroutine 56 [runnable]:
os_test.TestProgWideChdir.func1(0x50e880, 0x47fae0, 0x50e8c0, 0x4)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1272
created by os_test.TestProgWideChdir
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1272 +0x80

goroutine 57 [runnable]:
os_test.TestProgWideChdir.func1(0x50e880, 0x47fae0, 0x50e8c0, 0x5)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1272
created by os_test.TestProgWideChdir
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1272 +0x80

goroutine 58 [runnable]:
os_test.TestProgWideChdir.func1(0x50e880, 0x47fae0, 0x50e8c0, 0x6)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1272
created by os_test.TestProgWideChdir
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1272 +0x80

goroutine 59 [runnable]:
os_test.TestProgWideChdir.func1(0x50e880, 0x47fae0, 0x50e8c0, 0x7)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1272
created by os_test.TestProgWideChdir
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1272 +0x80

goroutine 60 [runnable]:
os_test.TestProgWideChdir.func1(0x50e880, 0x47fae0, 0x50e8c0, 0x8)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1272
created by os_test.TestProgWideChdir
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1272 +0x80

goroutine 61 [runnable]:
runtime.LockOSThread()
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/runtime/proc.go:3530 +0x5c
os_test.TestProgWideChdir.func1(0x50e880, 0x47fae0, 0x50e8c0, 0x9)
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1281 +0x124
created by os_test.TestProgWideChdir
	/home/gopher/build/openbsd-arm-c468ad04177c/go/src/os/os_test.go:1272 +0x80

trap    0x0
error   0x0
oldmask 0x0
r0      0x4
r1      0x0
r2      0x0
r3      0x4d973c
r4      0x40
r5      0x0
r6      0x0
r7      0x1993c0
r8      0x7
r9      0x2
r10     0x4015e0
fp      0x29004c
ip      0x48
sp      0x4d96f4
lr      0x3b294
pc      0x6c974
cpsr    0x20000010
fault   0x0
*** Test killed with quit: ran too long (37m0s).
FAIL	os	2220.194s
```

</details><br>