]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: disable crash stack on Windows
authorCherry Mui <cherryyz@google.com>
Mon, 20 Nov 2023 21:33:29 +0000 (16:33 -0500)
committerCherry Mui <cherryyz@google.com>
Tue, 21 Nov 2023 02:06:54 +0000 (02:06 +0000)
Apparently, on Windows, throwing an exception on a non-system-
allocated crash stack causes EXCEPTION_STACK_OVERFLOW and hangs
the process (see issue #63938). Disable crash stack for now, which
gets us back the the behavior of Go 1.21.

Fixes #63938.

Change-Id: I4c090315b93b484e756b242f0de7a9e02f199261
Reviewed-on: https://go-review.googlesource.com/c/go/+/543996
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
src/runtime/crash_test.go
src/runtime/proc.go

index ffd99f3a87b75a31851ce606a91610ef835618b6..2ed0fd8f0718f84c862fd7f138fe066f3021cd69 100644 (file)
@@ -795,14 +795,12 @@ func TestG0StackOverflow(t *testing.T) {
        if runtime.GOOS == "ios" {
                testenv.SkipFlaky(t, 62671)
        }
-       if runtime.GOOS == "windows" && runtime.GOARCH == "arm64" {
-               testenv.SkipFlaky(t, 63938) // TODO(cherry): fix and unskip
-       }
 
        if os.Getenv("TEST_G0_STACK_OVERFLOW") != "1" {
                cmd := testenv.CleanCmdEnv(testenv.Command(t, os.Args[0], "-test.run=^TestG0StackOverflow$", "-test.v"))
                cmd.Env = append(cmd.Env, "TEST_G0_STACK_OVERFLOW=1")
                out, err := cmd.CombinedOutput()
+               t.Logf("output:\n%s", out)
                // Don't check err since it's expected to crash.
                if n := strings.Count(string(out), "morestack on g0\n"); n != 1 {
                        t.Fatalf("%s\n(exit status %v)", out, err)
index 18826abb0628e6446f41377a35febee6a9d1cc7e..edf692fd1a13dc934a6da251fb6b10e45fb0cfee 100644 (file)
@@ -576,7 +576,10 @@ func switchToCrashStack(fn func()) {
        abort()
 }
 
-const crashStackImplemented = GOARCH == "amd64" || GOARCH == "arm64" || GOARCH == "mips64" || GOARCH == "mips64le" || GOARCH == "ppc64" || GOARCH == "ppc64le" || GOARCH == "riscv64" || GOARCH == "wasm"
+// Disable crash stack on Windows for now. Apparently, throwing an exception
+// on a non-system-allocated crash stack causes EXCEPTION_STACK_OVERFLOW and
+// hangs the process (see issue 63938).
+const crashStackImplemented = (GOARCH == "amd64" || GOARCH == "arm64" || GOARCH == "mips64" || GOARCH == "mips64le" || GOARCH == "ppc64" || GOARCH == "ppc64le" || GOARCH == "riscv64" || GOARCH == "wasm") && GOOS != "windows"
 
 //go:noescape
 func switchToCrashStack0(fn func()) // in assembly