aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/panic.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2023-06-06 13:02:29 -0400
committerGopher Robot <gobot@golang.org>2023-06-06 21:29:01 +0000
commit5b6e6d2b3d4d6877c86471209e249f1b6e36d0ca (patch)
tree347b946885b7edf99eef6be08974248c710d0f9e /src/runtime/panic.go
parent1aaf1b219a44feaeaa1d737b5ea82202e9dbd5de (diff)
downloadgo-5b6e6d2b3d4d6877c86471209e249f1b6e36d0ca.tar.xz
runtime: make GODEBUG=dontfreezetheworld=1 safer
GODEBUG=dontfreezetheworld=1 allows goroutines to continue execution during fatal panic. This increases the chance that tracebackothers will encounter running goroutines that it must skip, which is expected and fine. However, it also introduces the risk that a goroutine transitions from stopped to running in the middle of traceback, which is unsafe and may cause traceback crashes. Mitigate this by halting M execution if it naturally enters the scheduler. This ensures that goroutines cannot transition from stopped to running after freezetheworld. We simply deadlock rather than using gcstopm to continue keeping disturbance to scheduler state to a minimum. Change-Id: I9aa8d84abf038ae17142f34f4384e920b1490e81 Reviewed-on: https://go-review.googlesource.com/c/go/+/501255 Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/panic.go')
-rw-r--r--src/runtime/panic.go3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/runtime/panic.go b/src/runtime/panic.go
index 6d6b05b201..64fa272385 100644
--- a/src/runtime/panic.go
+++ b/src/runtime/panic.go
@@ -1247,9 +1247,6 @@ func startpanic_m() bool {
if debug.schedtrace > 0 || debug.scheddetail > 0 {
schedtrace(true)
}
- if debug.dontfreezetheworld > 0 {
- return true
- }
freezetheworld()
return true
case 1: