diff options
| author | Michael Pratt <mpratt@google.com> | 2025-12-03 15:42:03 -0500 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-01-22 07:33:17 -0800 |
| commit | d2aad0df601df3a48ee4823309872cd224d91aa3 (patch) | |
| tree | 86bc32953ecf96ac905527457cb90ebba9a49c5c /src | |
| parent | bfb851c31eaf385649263e42e1a8620e2df01158 (diff) | |
| download | go-d2aad0df601df3a48ee4823309872cd224d91aa3.tar.xz | |
runtime: guard unexpected return pc gp.m dereference
If stack scanning reaches here while scanning a waiting goroutine, gp.m
will be nil. We are going to crash anyway because the stack is corrupt,
but we still want to reach the print below for context rather than dying
with a SIGSEGV here.
For #64030.
Change-Id: I6a6a636c378669dc45972e1eb8e06401a0fed223
Reviewed-on: https://go-review.googlesource.com/c/go/+/726522
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/runtime/traceback.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index 1c6f24c033..4fe0fd89e2 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -456,7 +456,7 @@ func (u *unwinder) next() { // get everything, so crash loudly. fail := u.flags&(unwindPrintErrors|unwindSilentErrors) == 0 doPrint := u.flags&unwindSilentErrors == 0 - if doPrint && gp.m.incgo && f.funcID == abi.FuncID_sigpanic { + if doPrint && gp.m != nil && gp.m.incgo && f.funcID == abi.FuncID_sigpanic { // We can inject sigpanic // calls directly into C code, // in which case we'll see a C |
