Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/rseq: Remove volatile from __rseq_abi

This is done in preparation for the selftest uplift to become compatible
with glibc-2.35.

All accesses to the __rseq_abi fields are volatile, but remove the
volatile from the TLS variable declaration, otherwise we are stuck with
volatile for the upcoming rseq_get_abi() helper.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-5-mathieu.desnoyers@efficios.com

authored by

Mathieu Desnoyers and committed by
Peter Zijlstra
94b80a19 930378d0

+4 -4
+2 -2
tools/testing/selftests/rseq/rseq.c
··· 30 30 #include "../kselftest.h" 31 31 #include "rseq.h" 32 32 33 - __thread volatile struct rseq_abi __rseq_abi = { 33 + __thread struct rseq_abi __rseq_abi = { 34 34 .cpu_id = RSEQ_ABI_CPU_ID_UNINITIALIZED, 35 35 }; 36 36 ··· 92 92 goto end; 93 93 } 94 94 if (errno != EBUSY) 95 - __rseq_abi.cpu_id = RSEQ_ABI_CPU_ID_REGISTRATION_FAILED; 95 + RSEQ_WRITE_ONCE(__rseq_abi.cpu_id, RSEQ_ABI_CPU_ID_REGISTRATION_FAILED); 96 96 ret = -1; 97 97 __rseq_refcount--; 98 98 end:
+2 -2
tools/testing/selftests/rseq/rseq.h
··· 43 43 #define RSEQ_INJECT_FAILED 44 44 #endif 45 45 46 - extern __thread volatile struct rseq_abi __rseq_abi; 46 + extern __thread struct rseq_abi __rseq_abi; 47 47 extern int __rseq_handled; 48 48 49 49 #define rseq_likely(x) __builtin_expect(!!(x), 1) ··· 139 139 140 140 static inline void rseq_clear_rseq_cs(void) 141 141 { 142 - __rseq_abi.rseq_cs.arch.ptr = 0; 142 + RSEQ_WRITE_ONCE(__rseq_abi.rseq_cs.arch.ptr, 0); 143 143 } 144 144 145 145 /*