1
0
mirror of https://github.com/golang/go synced 2024-11-26 15:27:04 -07:00

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 #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>
This commit is contained in:
Cherry Mui 2023-11-20 16:33:29 -05:00
parent 195c88b202
commit dc094f9c96
2 changed files with 5 additions and 4 deletions

View File

@ -795,14 +795,12 @@ func TestG0StackOverflow(t *testing.T) {
if runtime.GOOS == "ios" { if runtime.GOOS == "ios" {
testenv.SkipFlaky(t, 62671) 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" { if os.Getenv("TEST_G0_STACK_OVERFLOW") != "1" {
cmd := testenv.CleanCmdEnv(testenv.Command(t, os.Args[0], "-test.run=^TestG0StackOverflow$", "-test.v")) cmd := testenv.CleanCmdEnv(testenv.Command(t, os.Args[0], "-test.run=^TestG0StackOverflow$", "-test.v"))
cmd.Env = append(cmd.Env, "TEST_G0_STACK_OVERFLOW=1") cmd.Env = append(cmd.Env, "TEST_G0_STACK_OVERFLOW=1")
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()
t.Logf("output:\n%s", out)
// Don't check err since it's expected to crash. // Don't check err since it's expected to crash.
if n := strings.Count(string(out), "morestack on g0\n"); n != 1 { if n := strings.Count(string(out), "morestack on g0\n"); n != 1 {
t.Fatalf("%s\n(exit status %v)", out, err) t.Fatalf("%s\n(exit status %v)", out, err)

View File

@ -576,7 +576,10 @@ func switchToCrashStack(fn func()) {
abort() 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 //go:noescape
func switchToCrashStack0(fn func()) // in assembly func switchToCrashStack0(fn func()) // in assembly