Skip to content

Commit dc094f9

Browse files
committed
runtime: disable crash stack on Windows
Apparently, on Windows, throwing an exception on a non-system- allocated crash stack causes EXCEPTION_STACK_OVERFLOW and hangs the process (see issue golang#63938). Disable crash stack for now, which gets us back the the behavior of Go 1.21. Fixes golang#63938. Change-Id: I4c090315b93b484e756b242f0de7a9e02f199261 Reviewed-on: https://go-review.googlesource.com/c/go/+/543996 Reviewed-by: Michael Knyszek <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Cherry Mui <[email protected]> Reviewed-by: Quim Muntal <[email protected]>
1 parent 195c88b commit dc094f9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/runtime/crash_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -795,14 +795,12 @@ func TestG0StackOverflow(t *testing.T) {
795795
if runtime.GOOS == "ios" {
796796
testenv.SkipFlaky(t, 62671)
797797
}
798-
if runtime.GOOS == "windows" && runtime.GOARCH == "arm64" {
799-
testenv.SkipFlaky(t, 63938) // TODO(cherry): fix and unskip
800-
}
801798

802799
if os.Getenv("TEST_G0_STACK_OVERFLOW") != "1" {
803800
cmd := testenv.CleanCmdEnv(testenv.Command(t, os.Args[0], "-test.run=^TestG0StackOverflow$", "-test.v"))
804801
cmd.Env = append(cmd.Env, "TEST_G0_STACK_OVERFLOW=1")
805802
out, err := cmd.CombinedOutput()
803+
t.Logf("output:\n%s", out)
806804
// Don't check err since it's expected to crash.
807805
if n := strings.Count(string(out), "morestack on g0\n"); n != 1 {
808806
t.Fatalf("%s\n(exit status %v)", out, err)

src/runtime/proc.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,10 @@ func switchToCrashStack(fn func()) {
576576
abort()
577577
}
578578

579-
const crashStackImplemented = GOARCH == "amd64" || GOARCH == "arm64" || GOARCH == "mips64" || GOARCH == "mips64le" || GOARCH == "ppc64" || GOARCH == "ppc64le" || GOARCH == "riscv64" || GOARCH == "wasm"
579+
// Disable crash stack on Windows for now. Apparently, throwing an exception
580+
// on a non-system-allocated crash stack causes EXCEPTION_STACK_OVERFLOW and
581+
// hangs the process (see issue 63938).
582+
const crashStackImplemented = (GOARCH == "amd64" || GOARCH == "arm64" || GOARCH == "mips64" || GOARCH == "mips64le" || GOARCH == "ppc64" || GOARCH == "ppc64le" || GOARCH == "riscv64" || GOARCH == "wasm") && GOOS != "windows"
580583

581584
//go:noescape
582585
func switchToCrashStack0(fn func()) // in assembly

0 commit comments

Comments
 (0)