From 494d65129ed5ae1154b75cc189bbdde5e9ecf1df Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Thu, 1 Aug 2024 10:35:34 -0400 Subject: nptl: Introduce for RSEQ_* accessors In preparation to move the rseq area to the 'extra TLS' block, we need accessors based on the thread pointer and the rseq offset. The ONCE variant of the accessors ensures single-copy atomicity for loads and stores which is required for all fields once the registration is active. A separate header is required to allow including which results in an include loop when added to . Signed-off-by: Michael Jeanson Reviewed-by: Mathieu Desnoyers Reviewed-by: Florian Weimer --- sysdeps/unix/sysv/linux/rseq-internal.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sysdeps/unix/sysv/linux') diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h index 3993431..00be15c 100644 --- a/sysdeps/unix/sysv/linux/rseq-internal.h +++ b/sysdeps/unix/sysv/linux/rseq-internal.h @@ -25,6 +25,7 @@ #include #include #include +#include /* Minimum size of the rseq area allocation required by the syscall. The actually used rseq feature size may be less (20 bytes initially). */ @@ -59,6 +60,13 @@ extern ptrdiff_t _rseq_offset attribute_hidden; rtld_hidden_proto (__rseq_size) rtld_hidden_proto (__rseq_offset) +/* Returns a pointer to the current thread rseq area. */ +static inline struct rseq_area * +RSEQ_SELF (void) +{ + return (struct rseq_area *) ((char *) __thread_pointer () + __rseq_offset); +} + #ifdef RSEQ_SIG static inline bool rseq_register_current_thread (struct pthread *self, bool do_rseq) -- cgit v1.1