From: Richard Miller Date: Mon, 18 May 2020 08:34:17 +0000 (+0100) Subject: runtime: don't enable notes (=signals) too early in Plan 9 X-Git-Tag: go1.15beta1~141 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bb59a1360a9e6c2d32a59461da56e9bc3a5703ef;p=gostls13.git runtime: don't enable notes (=signals) too early in Plan 9 The Plan 9 runtime startup was enabling notes (like Unix signals) before the gsignal stack was allocated. This left a small window of time where an interrupt (eg by the parent killing a subprocess quickly after exec) would cause a null pointer dereference in sigtramp. This would leave the interrupted process suspended in 'broken' state instead of exiting. We've observed this on the builders, where it can make a test time out waiting for the broken process to terminate. Updates #38772 Change-Id: I54584069fd3109595f06c78724c1f6419e028aab Reviewed-on: https://go-review.googlesource.com/c/go/+/234397 Run-TryBot: David du Colombier <0intro@gmail.com> TryBot-Result: Gobot Gobot Reviewed-by: David du Colombier <0intro@gmail.com> --- diff --git a/src/runtime/os_plan9.go b/src/runtime/os_plan9.go index b534cdba5d..2bea1058f2 100644 --- a/src/runtime/os_plan9.go +++ b/src/runtime/os_plan9.go @@ -293,7 +293,6 @@ func osinit() { ncpu = getproccount() physPageSize = getPageSize() getg().m.procid = getpid() - notify(unsafe.Pointer(funcPC(sigtramp))) } //go:nosplit @@ -311,6 +310,9 @@ func goenvs() { } func initsig(preinit bool) { + if !preinit { + notify(unsafe.Pointer(funcPC(sigtramp))) + } } //go:nosplit