Skip to content

Commit

Permalink
runtime: don't enable notes (=signals) too early in Plan 9
Browse files Browse the repository at this point in the history
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 <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: David du Colombier <[email protected]>
  • Loading branch information
Richard Miller authored and 0intro committed May 18, 2020
1 parent 2b70ffe commit bb59a13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/runtime/os_plan9.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ func osinit() {
ncpu = getproccount()
physPageSize = getPageSize()
getg().m.procid = getpid()
notify(unsafe.Pointer(funcPC(sigtramp)))
}

//go:nosplit
Expand All @@ -311,6 +310,9 @@ func goenvs() {
}

func initsig(preinit bool) {
if !preinit {
notify(unsafe.Pointer(funcPC(sigtramp)))
}
}

//go:nosplit
Expand Down

0 comments on commit bb59a13

Please sign in to comment.