From 2ca51cba03ab27427b143ac24dae03c720017835 Mon Sep 17 00:00:00 2001 From: "Jayanth Krishnamurthy jayanth.krishnamurthy@ibm.com" Date: Thu, 6 Nov 2025 13:43:45 -0600 Subject: [PATCH] [release-branch.go1.24] runtime/race: set missing argument frame for ppc64x atomic And/Or wrappers The ppc64x TSAN wrappers for atomic And/Or did not initialize R6 with the Go argument frame before calling racecallatomic. Since racecallatomic expects R6 to point to the argument list and dereferences it unconditionally, this led to a nil-pointer dereference under -race. Other atomic TSAN wrappers (Load/Store/Add/Swap/CAS) already set up R6 in the expected way. This change aligns the And/Or wrappers with the rest by adding the missing R6 initialisation. This keeps the behavior consistent across all atomic operations on ppc64x. Fixes #76796. Change-Id: Iaf578449a6171a0c6f7c33ec6f64c1251297ae6d Reviewed-on: https://go-review.googlesource.com/c/go/+/718560 Reviewed-by: Mark Freeman LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui Reviewed-by: Paul Murphy (cherry picked from commit 44cb82449e7f24530fe0fe0bf8261ba9e0e4e7d8) Reviewed-on: https://go-review.googlesource.com/c/go/+/729420 Reviewed-by: Roland Shoemaker --- src/runtime/race_ppc64le.s | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/runtime/race_ppc64le.s b/src/runtime/race_ppc64le.s index 43829479bd..bd168a38a9 100644 --- a/src/runtime/race_ppc64le.s +++ b/src/runtime/race_ppc64le.s @@ -329,11 +329,13 @@ TEXT sync∕atomic·AddUintptr(SB), NOSPLIT, $0-24 TEXT sync∕atomic·AndInt32(SB), NOSPLIT, $0-20 GO_ARGS MOVD $__tsan_go_atomic32_fetch_and(SB), R8 + ADD $32, R1, R6 BR racecallatomic<>(SB) TEXT sync∕atomic·AndInt64(SB), NOSPLIT, $0-24 GO_ARGS MOVD $__tsan_go_atomic64_fetch_and(SB), R8 + ADD $32, R1, R6 BR racecallatomic<>(SB) TEXT sync∕atomic·AndUint32(SB), NOSPLIT, $0-20 @@ -352,11 +354,13 @@ TEXT sync∕atomic·AndUintptr(SB), NOSPLIT, $0-24 TEXT sync∕atomic·OrInt32(SB), NOSPLIT, $0-20 GO_ARGS MOVD $__tsan_go_atomic32_fetch_or(SB), R8 + ADD $32, R1, R6 BR racecallatomic<>(SB) TEXT sync∕atomic·OrInt64(SB), NOSPLIT, $0-24 GO_ARGS MOVD $__tsan_go_atomic64_fetch_or(SB), R8 + ADD $32, R1, R6 BR racecallatomic<>(SB) TEXT sync∕atomic·OrUint32(SB), NOSPLIT, $0-20 -- 2.52.0