]> Cypherpunks repositories - gostls13.git/commit
runtime: ignore SPWrite on innermost traceback frame
authorAustin Clements <austin@google.com>
Tue, 5 Sep 2023 20:10:02 +0000 (16:10 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 6 Sep 2023 14:45:46 +0000 (14:45 +0000)
commit4c5130a96eabd5d9a72a43aa8e895b668fbd653b
tree6afec433ae405f9ced1e916024c677d43f422847
parent08e35cc3347f97ef750fd21fbef1061b043580e4
runtime: ignore SPWrite on innermost traceback frame

Prior to CL 458218, gentraceback ignored the SPWrite function flag on
the innermost frame when doing a precise traceback on the assumption
that precise tracebacks could only be started from the morestack
prologue, and that meant that the innermost function could not have
modified SP yet.

CL 458218 rearranged this logic a bit and unintentionally lost this
particular case. As a result, if traceback starts in an assembly
function that modifies SP (either as a result of stack growth or stack
scanning during a GC preemption), traceback stop at the SPWrite
function and then crash with "traceback did not unwind completely".

Fix this by restoring the earlier special case for when the innermost
frame is SPWrite.

This is a fairly minimal change that should be easy to backport. I
think a more robust change would be to encode this per-PC in the
spdelta table, so it would be clear that we're unwinding from the
morestack prologue and wouldn't rely on a complicated and potentially
fragile set of conditions.

Fixes #62326.

Change-Id: I34f38157631890d33a79d0bd32e32c0fcc2574e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/525835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/import_test.go
src/runtime/test_amd64.go [new file with mode: 0644]
src/runtime/test_amd64.s [new file with mode: 0644]
src/runtime/test_stubs.go [new file with mode: 0644]
src/runtime/traceback.go
src/runtime/tracebackx_test.go [new file with mode: 0644]