Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: morestack_noctxt missing SPWRITE, causes "traceback stuck" assert [1.19 backport] #54675

Closed
gopherbot opened this issue Aug 25, 2022 · 4 comments
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime.
Milestone

Comments

@gopherbot
Copy link

gopherbot commented Aug 25, 2022

@cherrymui requested issue #54332 to be considered for backport to the next 1.19 minor release.

@gopherbot please backport this to previous releases. This may cause a runtime crash. Thanks.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Aug 25, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Aug 25, 2022
@gopherbot gopherbot added this to the Go1.19.1 milestone Aug 25, 2022
@gopherbot
Copy link
Author

gopherbot commented Aug 25, 2022

Change https://go.dev/cl/425615 mentions this issue: [release-branch.go1.19] runtime: mark morestack_noctxt SPWRITE on LR architectures

@heschi heschi added the CherryPickApproved Used during the release process for point releases label Aug 31, 2022
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Aug 31, 2022
gopherbot pushed a commit that referenced this issue Aug 31, 2022
…architectures

On LR architectures, morestack (and morestack_noctxt) are called
with a special calling convention, where the caller doesn't save
LR on stack but passes it as a register, which morestack will save
to g.sched.lr. The stack unwinder currently doesn't understand it,
and would fail to unwind from it. morestack already writes SP (as
it switches stack), but morestack_noctxt (which tailcalls
morestack) doesn't. If a profiling signal lands right in
morestack_noctxt, the unwinder will try to unwind the stack and
go off, and possibly crash.

Marking morestack_noctxt SPWRITE stops the unwinding.

Ideally we could teach the unwinder about the special calling
convention, or change the calling convention to be less special
(so the unwinder doesn't need to fetch a register from the signal
context). This is a stop-gap solution, to stop the unwinder from
crashing.

Updates #54332.
Fixes #54675.

Change-Id: I75295f2e27ddcf05f1ea0b541aedcb9000ae7576
Reviewed-on: https://go-review.googlesource.com/c/go/+/425396
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
(cherry picked from commit e4be2ac)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425615
@gopherbot
Copy link
Author

gopherbot commented Aug 31, 2022

Closed by merging 0bba4d2 to release-branch.go1.19.

bradfitz pushed a commit to tailscale/go that referenced this issue Sep 8, 2022
…architectures

On LR architectures, morestack (and morestack_noctxt) are called
with a special calling convention, where the caller doesn't save
LR on stack but passes it as a register, which morestack will save
to g.sched.lr. The stack unwinder currently doesn't understand it,
and would fail to unwind from it. morestack already writes SP (as
it switches stack), but morestack_noctxt (which tailcalls
morestack) doesn't. If a profiling signal lands right in
morestack_noctxt, the unwinder will try to unwind the stack and
go off, and possibly crash.

Marking morestack_noctxt SPWRITE stops the unwinding.

Ideally we could teach the unwinder about the special calling
convention, or change the calling convention to be less special
(so the unwinder doesn't need to fetch a register from the signal
context). This is a stop-gap solution, to stop the unwinder from
crashing.

Updates golang#54332.
Fixes golang#54675.

Change-Id: I75295f2e27ddcf05f1ea0b541aedcb9000ae7576
Reviewed-on: https://go-review.googlesource.com/c/go/+/425396
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
(cherry picked from commit e4be2ac)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425615
@lizthegrey
Copy link

lizthegrey commented Sep 16, 2022

Backport confirmed working and stable in 1.19.1

@cherrymui
Copy link
Member

cherrymui commented Sep 16, 2022

Thanks @lizthegrey for confirming! This is great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime.
Projects
None yet
Development

No branches or pull requests

4 participants