]> Cypherpunks repositories - gostls13.git/commit
runtime: don't clobber saved frame pointer during arm64 racecall
authorNick Ripley <nick.ripley@datadoghq.com>
Mon, 5 Feb 2024 19:20:10 +0000 (14:20 -0500)
committerGopher Robot <gobot@golang.org>
Tue, 27 Feb 2024 20:11:27 +0000 (20:11 +0000)
commit234390e741dd43b1ce54b0cfd91dc591c0b190f7
tree72d27fa9003f1754b087822cb887bde45fe8afd2
parenta6a5c30d2b1338a8445de2499fbe7e9dda103efb
runtime: don't clobber saved frame pointer during arm64 racecall

During calls to the race detector on arm64, we switch to the g0 stack if
we aren't already on it. If we are already on the g0 stack, the race
detector library code can then create a stack frame using the stack
pointer coming from Go code. The race detector library can go on to
write values to the top of its stack frame. But the Go ABI for arm64
saves the caller's frame pointer in the word below the current stack
frame. So, the saved frame pointer on the stack can be clobbered by the
race detector. Decrement the stack pointer to account for where the
frame pointer is saved, like we do for asmcgocall.

Change-Id: I66e5e4a671c3befc10776bac6869810ecf71790d
Reviewed-on: https://go-review.googlesource.com/c/go/+/561515
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/runtime/race_arm64.s