mirror of
https://github.com/golang/go
synced 2024-11-06 10:36:13 -07:00
runtime: move zero-sized frame check from newproc to newproc1
If GOEXPERIMENT=regabidefer is enabled, newproc currently checks that the call frame for new goroutines is empty. But there's one place in the runtime (debugCallWrap), where we call newproc1, and it happens to pass a non-empty frame. The current check didn't catch that. Move the empty call frame check from newproc to newproc1 to catch this. Updates #40724. Change-Id: I9998faf1e07e7b7af88e06a8177127f998c40252 Reviewed-on: https://go-review.googlesource.com/c/go/+/309034 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
189c6946f5
commit
352d329c44
@ -9,8 +9,12 @@
|
||||
// spends all of its time in the race runtime, which isn't a safe
|
||||
// point.
|
||||
|
||||
//go:build amd64 && linux && !race
|
||||
// +build amd64,linux,!race
|
||||
// TODO(register args): We skip this under GOEXPERIMENT=regabidefer
|
||||
// because debugCallWrap passes a non-empty frame to newproc1,
|
||||
// triggering a panic.
|
||||
|
||||
//go:build amd64 && linux && !race && !goexperiment.regabidefer
|
||||
// +build amd64,linux,!race,!goexperiment.regabidefer
|
||||
|
||||
package runtime_test
|
||||
|
||||
|
@ -4020,12 +4020,6 @@ func malg(stacksize int32) *g {
|
||||
//
|
||||
//go:nosplit
|
||||
func newproc(siz int32, fn *funcval) {
|
||||
if goexperiment.RegabiDefer && siz != 0 {
|
||||
// TODO: When we commit to GOEXPERIMENT=regabidefer,
|
||||
// rewrite newproc's comment, since it will no longer
|
||||
// have a funny stack layout or need to be nosplit.
|
||||
throw("go with non-empty frame")
|
||||
}
|
||||
argp := add(unsafe.Pointer(&fn), sys.PtrSize)
|
||||
gp := getg()
|
||||
pc := getcallerpc()
|
||||
@ -4051,6 +4045,14 @@ func newproc(siz int32, fn *funcval) {
|
||||
//
|
||||
//go:systemstack
|
||||
func newproc1(fn *funcval, argp unsafe.Pointer, narg int32, callergp *g, callerpc uintptr) *g {
|
||||
if goexperiment.RegabiDefer && narg != 0 {
|
||||
// TODO: When we commit to GOEXPERIMENT=regabidefer,
|
||||
// rewrite the comments for newproc and newproc1.
|
||||
// newproc will no longer have a funny stack layout or
|
||||
// need to be nosplit.
|
||||
throw("go with non-empty frame")
|
||||
}
|
||||
|
||||
_g_ := getg()
|
||||
|
||||
if fn == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user