Skip to content

Commit

Permalink
selftests/rseq: Remove volatile from __rseq_abi
Browse files Browse the repository at this point in the history
commit 94b80a1 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@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-5-mathieu.desnoyers@efficios.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
compudj authored and gregkh committed Jul 7, 2022
1 parent 68e1232 commit 3c2a416
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/rseq/rseq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/rseq/rseq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -139,7 +139,7 @@ static inline uint32_t rseq_current_cpu(void)

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);
}

/*
Expand Down

0 comments on commit 3c2a416

Please sign in to comment.