Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: nosplit stack overflow with -gcflags "all=-N -l" -race (darwin/arm64 | Goland debug cmd) #54291

Open
ghostiam opened this issue Aug 5, 2022 · 11 comments
Assignees
Labels
compiler/runtime NeedsInvestigation
Milestone

Comments

@ghostiam
Copy link

ghostiam commented Aug 5, 2022

What version of Go are you using (go version)?

$ go version
go version go1.18.5 darwin/arm64

Does this issue reproduce with the latest release?

Yes (go 1.19)

$ go version
go version go1.19 darwin/arm64

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/ghostiam/Library/Caches/go-build"
GOENV="/Users/ghostiam/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/ghostiam/projects/golang/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/ghostiam/projects/golang"
GOPRIVATE=""
GOPROXY="http://localhost:8123"
GOROOT="/Users/ghostiam/projects/golang/sdk/go1.19"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/ghostiam/projects/golang/sdk/go1.19/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/ghostiam/Desktop/test/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/pc/st46ghc9375gx_q1ktbvpq900000gn/T/go-build1017110940=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

go build -gcflags "all=-N -l" -race -v

2 lines of code:
https://go.dev/play/p/v-LC84qDHo4

package main

import (
	"os/exec"
)

func main() {
	cmd := exec.Command("echo", "test")
	_ = cmd.Start()
}

What did you expect to see?

Successful build and debug

What did you see instead?

go 1.18.5 Output
$ go build  -gcflags "all=-N -l" -race -v
test
# test
runtime.fatalthrow: nosplit stack overflow
	792	assumed on entry to syscall.ptrace<1> (nosplit)
	664	after syscall.ptrace<1> (nosplit) uses 128
	456	after syscall.ptrace1<1> (nosplit) uses 208
	264	after syscall.syscall6<1> (nosplit) uses 192
	232	after runtime.entersyscall<1> (nosplit) uses 32
	168	after runtime.reentersyscall<1> (nosplit) uses 64
	136	after runtime.save<1> (nosplit) uses 32
	104	after runtime.badctxt<1> (nosplit) uses 32
	56	after runtime.throw<1> (nosplit) uses 48
	-8	after runtime.fatalthrow<1> (nosplit) uses 64
go 1.19 Output
$ go build  -gcflags "all=-N -l" -race -v
unicode/utf8
math/bits
internal/itoa
internal/unsafeheader
internal/goos
internal/goarch
unicode
internal/goexperiment
runtime/internal/math
runtime/internal/sys
internal/abi
sync/atomic
internal/cpu
math
runtime/internal/atomic
internal/bytealg
runtime
internal/reflectlite
internal/race
sync
internal/testlog
errors
sort
internal/oserror
path
io
strconv
syscall
bytes
strings
internal/syscall/execenv
internal/syscall/unix
time
runtime/cgo
context
io/fs
internal/poll
os
internal/godebug
path/filepath
os/exec
runtime/race
test
# test
syscall.ptrace: nosplit stack over 792 byte limit
syscall.ptrace<1>
    grows 128 bytes, calls syscall.ptrace1<1>
        grows 208 bytes, calls syscall.syscall6<1>
            grows 192 bytes, calls runtime.entersyscall<1>
                grows 32 bytes, calls runtime.reentersyscall<1>
                    grows 64 bytes, calls runtime.save<1>
                        grows 32 bytes, calls runtime.badctxt<1>
                            grows 32 bytes, calls runtime.throw<1>
                                grows 48 bytes, calls runtime.fatalthrow<1>
                                    grows 64 bytes, calls runtime.systemstack<0>
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.abort<0>
                                        24 bytes over limit
                                        grows 16 bytes, calls gosave_systemstack_switch<21>
                                            grows 0 bytes, calls runtime.abort<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        24 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        24 bytes over limit
                    grows 64 bytes, calls runtime.casgstatus<1>
                        grows 80 bytes, calls runtime.nanotime<1>
                            grows 32 bytes, calls runtime.nanotime1<0>
                                grows 48 bytes, calls runtime.libcCall<1>
                                    grows 64 bytes, calls runtime.(*guintptr).set<1>
                                    56 bytes over limit
                                    grows 64 bytes, calls runtime.asmcgocall<0>
                                        grows 16 bytes, calls gosave_systemstack_switch<21>
                                            grows 0 bytes, calls runtime.abort<0>
                                            72 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        72 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            72 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        72 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            72 bytes over limit
                        grows 80 bytes, calls runtime.nanotime<1>
                            grows 32 bytes, calls runtime.nanotime1<0>
                                grows 48 bytes, calls runtime.libcCall<1>
                                    grows 64 bytes, calls runtime.(*guintptr).set<1>
                                    56 bytes over limit
                                    grows 64 bytes, calls runtime.asmcgocall<0>
                                        grows 16 bytes, calls gosave_systemstack_switch<21>
                                            grows 0 bytes, calls runtime.abort<0>
                                            72 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        72 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            72 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        72 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            72 bytes over limit
                        grows 80 bytes, calls runtime.osyield<1>
                            grows 32 bytes, calls runtime.usleep<0>
                                grows 32 bytes, calls runtime.libcCall<1>
                                    grows 64 bytes, calls runtime.(*guintptr).set<1>
                                    40 bytes over limit
                                    grows 64 bytes, calls runtime.asmcgocall<0>
                                        grows 16 bytes, calls gosave_systemstack_switch<21>
                                            grows 0 bytes, calls runtime.abort<0>
                                            56 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        56 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            56 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        56 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            56 bytes over limit
                        grows 80 bytes, calls runtime.nanotime<1>
                            grows 32 bytes, calls runtime.nanotime1<0>
                                grows 48 bytes, calls runtime.libcCall<1>
                                    grows 64 bytes, calls runtime.(*guintptr).set<1>
                                    56 bytes over limit
                                    grows 64 bytes, calls runtime.asmcgocall<0>
                                        grows 16 bytes, calls gosave_systemstack_switch<21>
                                            grows 0 bytes, calls runtime.abort<0>
                                            72 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        72 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            72 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        72 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            72 bytes over limit
                        grows 80 bytes, calls runtime.nanotime<1>
                            grows 32 bytes, calls runtime.nanotime1<0>
                                grows 48 bytes, calls runtime.libcCall<1>
                                    grows 64 bytes, calls runtime.(*guintptr).set<1>
                                    56 bytes over limit
                                    grows 64 bytes, calls runtime.asmcgocall<0>
                                        grows 16 bytes, calls gosave_systemstack_switch<21>
                                            grows 0 bytes, calls runtime.abort<0>
                                            72 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        72 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            72 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        72 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            72 bytes over limit
                        grows 80 bytes, calls runtime.nanotime<1>
                            grows 32 bytes, calls runtime.nanotime1<0>
                                grows 48 bytes, calls runtime.libcCall<1>
                                    grows 64 bytes, calls runtime.(*guintptr).set<1>
                                    56 bytes over limit
                                    grows 64 bytes, calls runtime.asmcgocall<0>
                                        grows 16 bytes, calls gosave_systemstack_switch<21>
                                            grows 0 bytes, calls runtime.abort<0>
                                            72 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        72 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            72 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        72 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            72 bytes over limit
                        grows 80 bytes, calls runtime.throw<1>
                            grows 48 bytes, calls runtime.fatalthrow<1>
                                grows 64 bytes, calls runtime.systemstack<0>
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.abort<0>
                                    40 bytes over limit
                                    grows 16 bytes, calls gosave_systemstack_switch<21>
                                        grows 0 bytes, calls runtime.abort<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    40 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    40 bytes over limit
                    grows 64 bytes, calls runtime.save<1>
                        grows 32 bytes, calls runtime.badctxt<1>
                            grows 32 bytes, calls runtime.throw<1>
                                grows 48 bytes, calls runtime.fatalthrow<1>
                                    grows 64 bytes, calls runtime.systemstack<0>
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.abort<0>
                                        24 bytes over limit
                                        grows 16 bytes, calls gosave_systemstack_switch<21>
                                            grows 0 bytes, calls runtime.abort<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        24 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        24 bytes over limit
                    grows 64 bytes, calls runtime.save<1>
                        grows 32 bytes, calls runtime.badctxt<1>
                            grows 32 bytes, calls runtime.throw<1>
                                grows 48 bytes, calls runtime.fatalthrow<1>
                                    grows 64 bytes, calls runtime.systemstack<0>
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.abort<0>
                                        24 bytes over limit
                                        grows 16 bytes, calls gosave_systemstack_switch<21>
                                            grows 0 bytes, calls runtime.abort<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        24 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        24 bytes over limit
                    grows 64 bytes, calls runtime.save<1>
                        grows 32 bytes, calls runtime.badctxt<1>
                            grows 32 bytes, calls runtime.throw<1>
                                grows 48 bytes, calls runtime.fatalthrow<1>
                                    grows 64 bytes, calls runtime.systemstack<0>
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.abort<0>
                                        24 bytes over limit
                                        grows 16 bytes, calls gosave_systemstack_switch<21>
                                            grows 0 bytes, calls runtime.abort<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        24 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        24 bytes over limit
                    grows 64 bytes, calls runtime.save<1>
                        grows 32 bytes, calls runtime.badctxt<1>
                            grows 32 bytes, calls runtime.throw<1>
                                grows 48 bytes, calls runtime.fatalthrow<1>
                                    grows 64 bytes, calls runtime.systemstack<0>
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.abort<0>
                                        24 bytes over limit
                                        grows 16 bytes, calls gosave_systemstack_switch<21>
                                            grows 0 bytes, calls runtime.abort<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        24 bytes over limit
                                        grows 16 bytes, calls indirect
                                            grows 0 bytes, calls runtime.morestack<0>
                                            24 bytes over limit
                                        grows 16 bytes, calls runtime.save_g<0>
                                        24 bytes over limit
            grows 192 bytes, calls runtime.exitsyscall<1>
                grows 64 bytes, calls runtime.exitsyscallfast<1>
                    grows 80 bytes, calls runtime.wirep<1>
                        grows 64 bytes, calls runtime.throw<1>
                            grows 48 bytes, calls runtime.systemstack<0>
                                grows 16 bytes, calls indirect
                                    grows 0 bytes, calls runtime.morestack<0>
                                    8 bytes over limit
                                grows 16 bytes, calls runtime.abort<0>
                                8 bytes over limit
                                grows 16 bytes, calls gosave_systemstack_switch<21>
                                    grows 0 bytes, calls runtime.abort<0>
                                    8 bytes over limit
                                grows 16 bytes, calls runtime.save_g<0>
                                8 bytes over limit
                                grows 16 bytes, calls indirect
                                    grows 0 bytes, calls runtime.morestack<0>
                                    8 bytes over limit
                                grows 16 bytes, calls runtime.save_g<0>
                                8 bytes over limit
                            grows 48 bytes, calls runtime.fatalthrow<1>
                                grows 64 bytes, calls runtime.systemstack<0>
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        72 bytes over limit
                                    grows 16 bytes, calls runtime.abort<0>
                                    72 bytes over limit
                                    grows 16 bytes, calls gosave_systemstack_switch<21>
                                        grows 0 bytes, calls runtime.abort<0>
                                        72 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    72 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        72 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    72 bytes over limit
                        grows 64 bytes, calls runtime.throw<1>
                            grows 48 bytes, calls runtime.systemstack<0>
                                grows 16 bytes, calls indirect
                                    grows 0 bytes, calls runtime.morestack<0>
                                    8 bytes over limit
                                grows 16 bytes, calls runtime.abort<0>
                                8 bytes over limit
                                grows 16 bytes, calls gosave_systemstack_switch<21>
                                    grows 0 bytes, calls runtime.abort<0>
                                    8 bytes over limit
                                grows 16 bytes, calls runtime.save_g<0>
                                8 bytes over limit
                                grows 16 bytes, calls indirect
                                    grows 0 bytes, calls runtime.morestack<0>
                                    8 bytes over limit
                                grows 16 bytes, calls runtime.save_g<0>
                                8 bytes over limit
                            grows 48 bytes, calls runtime.fatalthrow<1>
                                grows 64 bytes, calls runtime.systemstack<0>
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        72 bytes over limit
                                    grows 16 bytes, calls runtime.abort<0>
                                    72 bytes over limit
                                    grows 16 bytes, calls gosave_systemstack_switch<21>
                                        grows 0 bytes, calls runtime.abort<0>
                                        72 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    72 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        72 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    72 bytes over limit
                grows 64 bytes, calls runtime.casgstatus<1>
                    grows 80 bytes, calls runtime.nanotime<1>
                        grows 32 bytes, calls runtime.nanotime1<0>
                            grows 48 bytes, calls runtime.libcCall<1>
                                grows 64 bytes, calls runtime.(*guintptr).set<1>
                                24 bytes over limit
                                grows 64 bytes, calls runtime.asmcgocall<0>
                                    grows 16 bytes, calls gosave_systemstack_switch<21>
                                        grows 0 bytes, calls runtime.abort<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    40 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    40 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        40 bytes over limit
                    grows 80 bytes, calls runtime.nanotime<1>
                        grows 32 bytes, calls runtime.nanotime1<0>
                            grows 48 bytes, calls runtime.libcCall<1>
                                grows 64 bytes, calls runtime.(*guintptr).set<1>
                                24 bytes over limit
                                grows 64 bytes, calls runtime.asmcgocall<0>
                                    grows 16 bytes, calls gosave_systemstack_switch<21>
                                        grows 0 bytes, calls runtime.abort<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    40 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    40 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        40 bytes over limit
                    grows 80 bytes, calls runtime.osyield<1>
                        grows 32 bytes, calls runtime.usleep<0>
                            grows 32 bytes, calls runtime.libcCall<1>
                                grows 64 bytes, calls runtime.(*guintptr).set<1>
                                8 bytes over limit
                                grows 64 bytes, calls runtime.asmcgocall<0>
                                    grows 16 bytes, calls gosave_systemstack_switch<21>
                                        grows 0 bytes, calls runtime.abort<0>
                                        24 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    24 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        24 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    24 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        24 bytes over limit
                    grows 80 bytes, calls runtime.nanotime<1>
                        grows 32 bytes, calls runtime.nanotime1<0>
                            grows 48 bytes, calls runtime.libcCall<1>
                                grows 64 bytes, calls runtime.(*guintptr).set<1>
                                24 bytes over limit
                                grows 64 bytes, calls runtime.asmcgocall<0>
                                    grows 16 bytes, calls gosave_systemstack_switch<21>
                                        grows 0 bytes, calls runtime.abort<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    40 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    40 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        40 bytes over limit
                    grows 80 bytes, calls runtime.nanotime<1>
                        grows 32 bytes, calls runtime.nanotime1<0>
                            grows 48 bytes, calls runtime.libcCall<1>
                                grows 64 bytes, calls runtime.(*guintptr).set<1>
                                24 bytes over limit
                                grows 64 bytes, calls runtime.asmcgocall<0>
                                    grows 16 bytes, calls gosave_systemstack_switch<21>
                                        grows 0 bytes, calls runtime.abort<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    40 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    40 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        40 bytes over limit
                    grows 80 bytes, calls runtime.nanotime<1>
                        grows 32 bytes, calls runtime.nanotime1<0>
                            grows 48 bytes, calls runtime.libcCall<1>
                                grows 64 bytes, calls runtime.(*guintptr).set<1>
                                24 bytes over limit
                                grows 64 bytes, calls runtime.asmcgocall<0>
                                    grows 16 bytes, calls gosave_systemstack_switch<21>
                                        grows 0 bytes, calls runtime.abort<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    40 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        40 bytes over limit
                                    grows 16 bytes, calls runtime.save_g<0>
                                    40 bytes over limit
                                    grows 16 bytes, calls indirect
                                        grows 0 bytes, calls runtime.morestack<0>
                                        40 bytes over limit
                    grows 80 bytes, calls runtime.throw<1>
                        grows 48 bytes, calls runtime.fatalthrow<1>
                            grows 64 bytes, calls runtime.systemstack<0>
                                grows 16 bytes, calls indirect
                                    grows 0 bytes, calls runtime.morestack<0>
                                    8 bytes over limit
                                grows 16 bytes, calls runtime.abort<0>
                                8 bytes over limit
                                grows 16 bytes, calls gosave_systemstack_switch<21>
                                    grows 0 bytes, calls runtime.abort<0>
                                    8 bytes over limit
                                grows 16 bytes, calls runtime.save_g<0>
                                8 bytes over limit
                                grows 16 bytes, calls indirect
                                    grows 0 bytes, calls runtime.morestack<0>
                                    8 bytes over limit
                                grows 16 bytes, calls runtime.save_g<0>
                                8 bytes over limit

Without -race everything compiles fine.

@gopherbot gopherbot added the compiler/runtime label Aug 5, 2022
@ghostiam ghostiam changed the title cmd/compile: nosplit stack overflow with -gcflags "all=-N -l" -race (Goland debug) cmd/compile: MacOS ARM: nosplit stack overflow with -gcflags "all=-N -l" -race (Goland debug) Aug 5, 2022
@ghostiam
Copy link
Author

ghostiam commented Aug 5, 2022

go1.18.4 darwin/arm64 and go1.18.3 darwin/arm64 - compiles without error

@ghostiam ghostiam changed the title cmd/compile: MacOS ARM: nosplit stack overflow with -gcflags "all=-N -l" -race (Goland debug) cmd/compile: darwin/arm64: nosplit stack overflow with -gcflags "all=-N -l" -race (Goland debug) Aug 5, 2022
@ghostiam ghostiam changed the title cmd/compile: darwin/arm64: nosplit stack overflow with -gcflags "all=-N -l" -race (Goland debug) cmd/compile: nosplit stack overflow with -gcflags "all=-N -l" -race (darwin/arm64 | Goland debug cmd) Aug 5, 2022
@hopehook
Copy link
Contributor

hopehook commented Aug 5, 2022

I can reproduce it stably now. (go version go1.19 darwin/amd64)

Output
syscall.ptrace: nosplit stack over 792 byte limit
syscall.ptrace<1>
    grows 120 bytes, calls syscall.ptrace1<1>
        grows 200 bytes, calls syscall.syscall6<1>
            grows 192 bytes, calls runtime.entersyscall<1>
                grows 32 bytes, calls runtime.reentersyscall<1>
                    grows 64 bytes, calls runtime.save<1>
                        grows 32 bytes, calls runtime.badctxt<1>
                            grows 32 bytes, calls runtime.throw<1>
                                grows 48 bytes, calls runtime.fatalthrow<1>
                                    grows 64 bytes, calls runtime.systemstack<0>
                                        grows 8 bytes, calls gosave_systemstack_switch<21>
                                            grows 8 bytes, calls runtime.abort<0>
                                            8 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            8 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            8 bytes over limit
                    grows 64 bytes, calls runtime.casgstatus<1>
                        grows 72 bytes, calls runtime.nanotime<1>
                            grows 24 bytes, calls runtime.nanotime1<0>
                                grows 48 bytes, calls runtime.libcCall<1>
                                    grows 64 bytes, calls runtime.(*guintptr).set<1>
                                    24 bytes over limit
                                    grows 64 bytes, calls runtime.asmcgocall<0>
                                        grows 8 bytes, calls gosave_systemstack_switch<21>
                                            grows 8 bytes, calls runtime.abort<0>
                                            40 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            40 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            40 bytes over limit
                        grows 72 bytes, calls runtime.nanotime<1>
                            grows 24 bytes, calls runtime.nanotime1<0>
                                grows 48 bytes, calls runtime.libcCall<1>
                                    grows 64 bytes, calls runtime.(*guintptr).set<1>
                                    24 bytes over limit
                                    grows 64 bytes, calls runtime.asmcgocall<0>
                                        grows 8 bytes, calls gosave_systemstack_switch<21>
                                            grows 8 bytes, calls runtime.abort<0>
                                            40 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            40 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            40 bytes over limit
                        grows 72 bytes, calls runtime.osyield<1>
                            grows 24 bytes, calls runtime.usleep<0>
                                grows 32 bytes, calls runtime.libcCall<1>
                                    grows 64 bytes, calls runtime.(*guintptr).set<1>
                                    8 bytes over limit
                                    grows 64 bytes, calls runtime.asmcgocall<0>
                                        grows 8 bytes, calls gosave_systemstack_switch<21>
                                            grows 8 bytes, calls runtime.abort<0>
                                            24 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            24 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            24 bytes over limit
                        grows 72 bytes, calls runtime.nanotime<1>
                            grows 24 bytes, calls runtime.nanotime1<0>
                                grows 48 bytes, calls runtime.libcCall<1>
                                    grows 64 bytes, calls runtime.(*guintptr).set<1>
                                    24 bytes over limit
                                    grows 64 bytes, calls runtime.asmcgocall<0>
                                        grows 8 bytes, calls gosave_systemstack_switch<21>
                                            grows 8 bytes, calls runtime.abort<0>
                                            40 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            40 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            40 bytes over limit
                        grows 72 bytes, calls runtime.nanotime<1>
                            grows 24 bytes, calls runtime.nanotime1<0>
                                grows 48 bytes, calls runtime.libcCall<1>
                                    grows 64 bytes, calls runtime.(*guintptr).set<1>
                                    24 bytes over limit
                                    grows 64 bytes, calls runtime.asmcgocall<0>
                                        grows 8 bytes, calls gosave_systemstack_switch<21>
                                            grows 8 bytes, calls runtime.abort<0>
                                            40 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            40 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            40 bytes over limit
                        grows 72 bytes, calls runtime.nanotime<1>
                            grows 24 bytes, calls runtime.nanotime1<0>
                                grows 48 bytes, calls runtime.libcCall<1>
                                    grows 64 bytes, calls runtime.(*guintptr).set<1>
                                    24 bytes over limit
                                    grows 64 bytes, calls runtime.asmcgocall<0>
                                        grows 8 bytes, calls gosave_systemstack_switch<21>
                                            grows 8 bytes, calls runtime.abort<0>
                                            40 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            40 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            40 bytes over limit
                        grows 72 bytes, calls runtime.throw<1>
                            grows 48 bytes, calls runtime.fatalthrow<1>
                                grows 64 bytes, calls runtime.systemstack<0>
                                    grows 8 bytes, calls gosave_systemstack_switch<21>
                                        grows 8 bytes, calls runtime.abort<0>
                                        16 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        16 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        16 bytes over limit
                    grows 64 bytes, calls runtime.save<1>
                        grows 32 bytes, calls runtime.badctxt<1>
                            grows 32 bytes, calls runtime.throw<1>
                                grows 48 bytes, calls runtime.fatalthrow<1>
                                    grows 64 bytes, calls runtime.systemstack<0>
                                        grows 8 bytes, calls gosave_systemstack_switch<21>
                                            grows 8 bytes, calls runtime.abort<0>
                                            8 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            8 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            8 bytes over limit
                    grows 64 bytes, calls runtime.save<1>
                        grows 32 bytes, calls runtime.badctxt<1>
                            grows 32 bytes, calls runtime.throw<1>
                                grows 48 bytes, calls runtime.fatalthrow<1>
                                    grows 64 bytes, calls runtime.systemstack<0>
                                        grows 8 bytes, calls gosave_systemstack_switch<21>
                                            grows 8 bytes, calls runtime.abort<0>
                                            8 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            8 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            8 bytes over limit
                    grows 64 bytes, calls runtime.save<1>
                        grows 32 bytes, calls runtime.badctxt<1>
                            grows 32 bytes, calls runtime.throw<1>
                                grows 48 bytes, calls runtime.fatalthrow<1>
                                    grows 64 bytes, calls runtime.systemstack<0>
                                        grows 8 bytes, calls gosave_systemstack_switch<21>
                                            grows 8 bytes, calls runtime.abort<0>
                                            8 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            8 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            8 bytes over limit
                    grows 64 bytes, calls runtime.save<1>
                        grows 32 bytes, calls runtime.badctxt<1>
                            grows 32 bytes, calls runtime.throw<1>
                                grows 48 bytes, calls runtime.fatalthrow<1>
                                    grows 64 bytes, calls runtime.systemstack<0>
                                        grows 8 bytes, calls gosave_systemstack_switch<21>
                                            grows 8 bytes, calls runtime.abort<0>
                                            8 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            8 bytes over limit
                                        grows 8 bytes, calls indirect
                                            grows 8 bytes, calls runtime.morestack<0>
                                            8 bytes over limit
            grows 192 bytes, calls runtime.exitsyscall<1>
                grows 64 bytes, calls runtime.exitsyscallfast<1>
                    grows 72 bytes, calls runtime.wirep<1>
                        grows 64 bytes, calls runtime.throw<1>
                            grows 48 bytes, calls runtime.fatalthrow<1>
                                grows 64 bytes, calls runtime.systemstack<0>
                                    grows 8 bytes, calls gosave_systemstack_switch<21>
                                        grows 8 bytes, calls runtime.abort<0>
                                        48 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        48 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        48 bytes over limit
                        grows 64 bytes, calls runtime.throw<1>
                            grows 48 bytes, calls runtime.fatalthrow<1>
                                grows 64 bytes, calls runtime.systemstack<0>
                                    grows 8 bytes, calls gosave_systemstack_switch<21>
                                        grows 8 bytes, calls runtime.abort<0>
                                        48 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        48 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        48 bytes over limit
                grows 64 bytes, calls runtime.casgstatus<1>
                    grows 72 bytes, calls runtime.nanotime<1>
                        grows 24 bytes, calls runtime.nanotime1<0>
                            grows 48 bytes, calls runtime.libcCall<1>
                                grows 64 bytes, calls runtime.asmcgocall<0>
                                    grows 8 bytes, calls gosave_systemstack_switch<21>
                                        grows 8 bytes, calls runtime.abort<0>
                                        8 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        8 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        8 bytes over limit
                    grows 72 bytes, calls runtime.nanotime<1>
                        grows 24 bytes, calls runtime.nanotime1<0>
                            grows 48 bytes, calls runtime.libcCall<1>
                                grows 64 bytes, calls runtime.asmcgocall<0>
                                    grows 8 bytes, calls gosave_systemstack_switch<21>
                                        grows 8 bytes, calls runtime.abort<0>
                                        8 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        8 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        8 bytes over limit
                    grows 72 bytes, calls runtime.nanotime<1>
                        grows 24 bytes, calls runtime.nanotime1<0>
                            grows 48 bytes, calls runtime.libcCall<1>
                                grows 64 bytes, calls runtime.asmcgocall<0>
                                    grows 8 bytes, calls gosave_systemstack_switch<21>
                                        grows 8 bytes, calls runtime.abort<0>
                                        8 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        8 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        8 bytes over limit
                    grows 72 bytes, calls runtime.nanotime<1>
                        grows 24 bytes, calls runtime.nanotime1<0>
                            grows 48 bytes, calls runtime.libcCall<1>
                                grows 64 bytes, calls runtime.asmcgocall<0>
                                    grows 8 bytes, calls gosave_systemstack_switch<21>
                                        grows 8 bytes, calls runtime.abort<0>
                                        8 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        8 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        8 bytes over limit
                    grows 72 bytes, calls runtime.nanotime<1>
                        grows 24 bytes, calls runtime.nanotime1<0>
                            grows 48 bytes, calls runtime.libcCall<1>
                                grows 64 bytes, calls runtime.asmcgocall<0>
                                    grows 8 bytes, calls gosave_systemstack_switch<21>
                                        grows 8 bytes, calls runtime.abort<0>
                                        8 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        8 bytes over limit
                                    grows 8 bytes, calls indirect
                                        grows 8 bytes, calls runtime.morestack<0>
                                        8 bytes over limit

@hopehook
Copy link
Contributor

hopehook commented Aug 5, 2022

CC @aclements

@seankhliao seankhliao added the NeedsInvestigation label Aug 5, 2022
@gopherbot
Copy link

gopherbot commented Aug 7, 2022

Change https://go.dev/cl/421954 mentions this issue: syscall: fix sycall.ptrace cause nosplit stack over 792 byte limit

@sh0umik
Copy link

sh0umik commented Aug 7, 2022

Confirmed in 1.19 version in M1 macs

@ianlancetaylor
Copy link
Contributor

ianlancetaylor commented Aug 7, 2022

Why is this case important? The only reason to use -all=N -l is for debugging. Why is it necessary to debug code compiled with -race?

@cuiweixie
Copy link
Contributor

cuiweixie commented Aug 7, 2022

Why is this case important? The only reason to use -all=N -l is for debugging. Why is it necessary to debug code compiled with -race?
the -"all=-N -l" is added by Goland 's debugger auto, some time may need to debug with race like some go test -v -race report a issue. I will do this sometimes.
@ghostiam please tell us your scene!

@cuiweixie
Copy link
Contributor

cuiweixie commented Aug 7, 2022

package main

import (
	"os/exec"
	"testing"
)

func TestA(t *testing.T) {
	cmd := exec.Command("echo", "test")
	_ = cmd.Start()
} 

below is Goland debug setting
image
as you can see debug with race must has "-N -l" setting, you even can not remove it
click with debug
image

@ianlancetaylor

@cuiweixie
Copy link
Contributor

cuiweixie commented Aug 7, 2022

debug with race to fix sync issues is quite usually for Gland users like me!

@ghostiam
Copy link
Author

ghostiam commented Aug 7, 2022

@ghostiam please tell us your scene!

I also have "-race" added to all projects that I develop by default so that I can always get race information.
I don't feel comfortable removing "-race" when I need to debug. Everything worked correctly before, why shouldn't it work now?

@mknyszek mknyszek added this to the Backlog milestone Aug 10, 2022
@mknyszek
Copy link
Contributor

mknyszek commented Aug 10, 2022

I'm not certain what we're going to do about this as this isn't necessarily a supported build configuration (AFAICT).

@cuonglm filed an upstream bug with Goland: https://youtrack.jetbrains.com/issue/GO-13486/Show-warning-when-debug-is-started-with-the-race-option. Assigning this @cuonglm for now. (Feel free to unassign! This is non-binding, just for triage. :))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime NeedsInvestigation
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

9 participants