Skip to content

Commit bb59a13

Browse files
Richard Miller0intro
Richard Miller
authored andcommitted
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 <gobot@golang.org> Reviewed-by: David du Colombier <0intro@gmail.com>
1 parent 2b70ffe commit bb59a13

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/runtime/os_plan9.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ func osinit() {
293293
ncpu = getproccount()
294294
physPageSize = getPageSize()
295295
getg().m.procid = getpid()
296-
notify(unsafe.Pointer(funcPC(sigtramp)))
297296
}
298297

299298
//go:nosplit
@@ -311,6 +310,9 @@ func goenvs() {
311310
}
312311

313312
func initsig(preinit bool) {
313+
if !preinit {
314+
notify(unsafe.Pointer(funcPC(sigtramp)))
315+
}
314316
}
315317

316318
//go:nosplit

0 commit comments

Comments
 (0)