This is a note to let you know that I've just added the patch titled selftests/rseq: Remove volatile from __rseq_abi to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: selftests-rseq-remove-volatile-from-__rseq_abi.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 94b80a19ebfe347a01301d750040a61c38200e2b Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> Date: Mon, 24 Jan 2022 12:12:42 -0500 Subject: selftests/rseq: Remove volatile from __rseq_abi From: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> commit 94b80a19ebfe347a01301d750040a61c38200e2b upstream. 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@xxxxxxxxxxxx> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> Link: https://lkml.kernel.org/r/20220124171253.22072-5-mathieu.desnoyers@xxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/rseq/rseq.c | 4 ++-- tools/testing/selftests/rseq/rseq.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/tools/testing/selftests/rseq/rseq.c +++ b/tools/testing/selftests/rseq/rseq.c @@ -30,7 +30,7 @@ #include "../kselftest.h" #include "rseq.h" -__thread volatile struct rseq_abi __rseq_abi = { +__thread struct rseq_abi __rseq_abi = { .cpu_id = RSEQ_ABI_CPU_ID_UNINITIALIZED, }; @@ -92,7 +92,7 @@ int rseq_register_current_thread(void) goto end; } if (errno != EBUSY) - __rseq_abi.cpu_id = RSEQ_ABI_CPU_ID_REGISTRATION_FAILED; + RSEQ_WRITE_ONCE(__rseq_abi.cpu_id, RSEQ_ABI_CPU_ID_REGISTRATION_FAILED); ret = -1; __rseq_refcount--; end: --- a/tools/testing/selftests/rseq/rseq.h +++ b/tools/testing/selftests/rseq/rseq.h @@ -43,7 +43,7 @@ #define RSEQ_INJECT_FAILED #endif -extern __thread volatile struct rseq_abi __rseq_abi; +extern __thread struct rseq_abi __rseq_abi; extern int __rseq_handled; #define rseq_likely(x) __builtin_expect(!!(x), 1) @@ -139,7 +139,7 @@ static inline uint32_t rseq_current_cpu( static inline void rseq_clear_rseq_cs(void) { - __rseq_abi.rseq_cs.arch.ptr = 0; + RSEQ_WRITE_ONCE(__rseq_abi.rseq_cs.arch.ptr, 0); } /* Patches currently in stable-queue which might be from mathieu.desnoyers@xxxxxxxxxxxx are queue-5.15/selftests-rseq-fix-work-around-asm-goto-compiler-bugs.patch queue-5.15/selftests-rseq-remove-arm-mips-asm-goto-compiler-work-around.patch queue-5.15/selftests-rseq-uplift-rseq-selftests-for-compatibility-with-glibc-2.35.patch queue-5.15/selftests-rseq-introduce-thread-pointer-getters.patch queue-5.15/selftests-rseq-introduce-own-copy-of-rseq-uapi-header.patch queue-5.15/selftests-rseq-introduce-rseq_get_abi-helper.patch queue-5.15/selftests-rseq-fix-ppc32-missing-instruction-selection-u-and-x-for-load-store.patch queue-5.15/selftests-rseq-change-type-of-rseq_offset-to-ptrdiff_t.patch queue-5.15/selftests-rseq-fix-ppc32-wrong-rseq_cs-32-bit-field-pointer-on-big-endian.patch queue-5.15/selftests-rseq-x86-32-use-gs-segment-selector-for-accessing-rseq-thread-area.patch queue-5.15/selftests-rseq-remove-volatile-from-__rseq_abi.patch queue-5.15/selftests-rseq-fix-warnings-about-if-checks-of-undefined-tokens.patch queue-5.15/selftests-rseq-fix-ppc32-offsets-by-using-long-rather-than-off_t.patch queue-5.15/selftests-rseq-remove-useless-assignment-to-cpu-variable.patch queue-5.15/selftests-rseq-x86-64-use-fs-segment-selector-for-accessing-rseq-thread-area.patch