diff options
| author | Ian Lance Taylor <iant@golang.org> | 2025-12-09 18:56:45 -0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-12-12 13:23:17 -0800 |
| commit | ee0275d15b4407038d30e27c9cc313c4ef339026 (patch) | |
| tree | 7e77ce3b703dcfc97f7de79a68d61a788002feee /src/runtime/stack.go | |
| parent | 63fced531c0d702554fcfda41f9016701a6859c6 (diff) | |
| download | go-ee0275d15b4407038d30e27c9cc313c4ef339026.tar.xz | |
runtime, cmd/link: tighten search for stackObjectRecord
A stackObjectRecord should always be in funcdata, between gofunc
and the end of pclntab, except for the special case of
methodValueCallFrameObjs, which should always be in noptrbss.
Adjust the two loops that look for the moduledata corresponding
to a stackObjectRecord to search more precisely, rather than
relying on datap.end.
Closely based on a patch by Michael Stapelberg.
For #76038
Change-Id: I751801d8fd030af751825a67905b2a343280e7d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/728840
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/stack.go')
| -rw-r--r-- | src/runtime/stack.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/runtime/stack.go b/src/runtime/stack.go index d1c80276a5..6f89cc142c 100644 --- a/src/runtime/stack.go +++ b/src/runtime/stack.go @@ -1357,7 +1357,13 @@ func (r *stackObjectRecord) gcdata() (uintptr, *byte) { ptr := uintptr(unsafe.Pointer(r)) var mod *moduledata for datap := &firstmoduledata; datap != nil; datap = datap.next { - if datap.gofunc <= ptr && ptr < datap.end { + // The normal case: stackObjectRecord is in funcdata. + if datap.gofunc <= ptr && ptr < datap.epclntab { + mod = datap + break + } + // A special case: methodValueCallFrameObjs. + if datap.noptrbss <= ptr && ptr < datap.enoptrbss { mod = datap break } |
