From: Michael Anthony Knyszek Date: Wed, 22 Nov 2023 16:36:23 +0000 (+0000) Subject: runtime: throw from the systemstack in wirep X-Git-Tag: go1.22rc1~158 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=37aed23f51edc81c1c5166c65b7652eca609fad8;p=gostls13.git runtime: throw from the systemstack in wirep The exitsyscall path, since the introduction of the new execution tracer, stores a just little bit more data in the exitsyscall stack frame, causing a build failure from exceeding the nosplit limit with '-N -l' set on all packages (like Delve does). One of the paths through which this fails is "throw" from wirep, called by a callee of exitsyscall. By switching to the systemstack on this path, we can avoid hitting the nosplit limit, fixing the build. It's also not totally unreasonable to switch to the systemstack for the throws in this function, since the function has to be nosplit anyway. It gives the throw path a bit more wiggle room to dump information than it otherwise would have. Fixes #64113. Change-Id: I56e94e40614a202b8ac2fdc8b8b731493b74e5d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/544535 LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui --- diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 7a2283e360..6348335804 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -5769,15 +5769,23 @@ func wirep(pp *p) { gp := getg() if gp.m.p != 0 { - throw("wirep: already in go") + // Call on the systemstack to avoid a nosplit overflow build failure + // on some platforms when built with -N -l. See #64113. + systemstack(func() { + throw("wirep: already in go") + }) } if pp.m != 0 || pp.status != _Pidle { - id := int64(0) - if pp.m != 0 { - id = pp.m.ptr().id - } - print("wirep: p->m=", pp.m, "(", id, ") p->status=", pp.status, "\n") - throw("wirep: invalid p state") + // Call on the systemstack to avoid a nosplit overflow build failure + // on some platforms when built with -N -l. See #64113. + systemstack(func() { + id := int64(0) + if pp.m != 0 { + id = pp.m.ptr().id + } + print("wirep: p->m=", pp.m, "(", id, ") p->status=", pp.status, "\n") + throw("wirep: invalid p state") + }) } gp.m.p.set(pp) pp.m.set(gp.m)