Skip to content

Commit 44cb824

Browse files
jkrishmysrandall77
authored andcommitted
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 #76051. Change-Id: Iaf578449a6171a0c6f7c33ec6f64c1251297ae6d Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10 Reviewed-on: https://go-review.googlesource.com/c/go/+/718560 Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Paul Murphy <paumurph@redhat.com>
1 parent 435e61c commit 44cb824

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/runtime/race_ppc64le.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,13 @@ TEXT sync∕atomic·AddUintptr(SB), NOSPLIT, $0-24
329329
TEXT sync∕atomic·AndInt32(SB), NOSPLIT, $0-20
330330
GO_ARGS
331331
MOVD $__tsan_go_atomic32_fetch_and(SB), R8
332+
ADD $32, R1, R6
332333
BR racecallatomic<>(SB)
333334

334335
TEXT sync∕atomic·AndInt64(SB), NOSPLIT, $0-24
335336
GO_ARGS
336337
MOVD $__tsan_go_atomic64_fetch_and(SB), R8
338+
ADD $32, R1, R6
337339
BR racecallatomic<>(SB)
338340

339341
TEXT sync∕atomic·AndUint32(SB), NOSPLIT, $0-20
@@ -352,11 +354,13 @@ TEXT sync∕atomic·AndUintptr(SB), NOSPLIT, $0-24
352354
TEXT sync∕atomic·OrInt32(SB), NOSPLIT, $0-20
353355
GO_ARGS
354356
MOVD $__tsan_go_atomic32_fetch_or(SB), R8
357+
ADD $32, R1, R6
355358
BR racecallatomic<>(SB)
356359

357360
TEXT sync∕atomic·OrInt64(SB), NOSPLIT, $0-24
358361
GO_ARGS
359362
MOVD $__tsan_go_atomic64_fetch_or(SB), R8
363+
ADD $32, R1, R6
360364
BR racecallatomic<>(SB)
361365

362366
TEXT sync∕atomic·OrUint32(SB), NOSPLIT, $0-20

0 commit comments

Comments
 (0)