aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorMichael Jeanson <mjeanson@efficios.com>2024-08-01 10:35:34 -0400
committerMichael Jeanson <mjeanson@efficios.com>2025-01-10 20:20:17 +0000
commit494d65129ed5ae1154b75cc189bbdde5e9ecf1df (patch)
tree0025adfdd5e774e0a9a5467b31996e54daa97e2d /sysdeps/unix/sysv
parentbe440f6c38ec2cdfd05439d2d90f140da34b8ce6 (diff)
downloadglibc-494d65129ed5ae1154b75cc189bbdde5e9ecf1df.zip
glibc-494d65129ed5ae1154b75cc189bbdde5e9ecf1df.tar.gz
glibc-494d65129ed5ae1154b75cc189bbdde5e9ecf1df.tar.bz2
nptl: Introduce <rseq-access.h> 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 <atomic.h> which results in an include loop when added to <tcb-access.h>. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/rseq-internal.h8
1 files changed, 8 insertions, 0 deletions
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 <stdio.h>
#include <sys/rseq.h>
#include <ldsodefs.h>
+#include <thread_pointer.h>
/* 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)