]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.19] runtime: mark morestack_noctxt SPWRITE on LR architectures
authorCherry Mui <cherryyz@google.com>
Wed, 24 Aug 2022 22:33:21 +0000 (18:33 -0400)
committerHeschi Kreinick <heschi@google.com>
Wed, 31 Aug 2022 16:31:38 +0000 (16:31 +0000)
commit0bba4d2fe614a2b54aa2bdaaaf47ae1eafeb561c
tree143a2895227dcd3ab8c2a35567725c3f5348c37e
parent823e5d8afaaf9fff0cc2ab04e7fc0a62b1023c3e
[release-branch.go1.19] runtime: mark morestack_noctxt SPWRITE on LR 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 e4be2ac79f3cc7219ae1cf8334463d11cae24e01)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425615
src/runtime/asm_arm.s
src/runtime/asm_arm64.s
src/runtime/asm_mips64x.s
src/runtime/asm_mipsx.s
src/runtime/asm_ppc64x.s
src/runtime/asm_riscv64.s
src/runtime/asm_s390x.s