diff options
author | Michael Jeanson <mjeanson@efficios.com> | 2024-11-20 22:28:07 +0000 |
---|---|---|
committer | Michael Jeanson <mjeanson@efficios.com> | 2025-01-10 20:19:53 +0000 |
commit | be440f6c38ec2cdfd05439d2d90f140da34b8ce6 (patch) | |
tree | 846ff069be02c0766858f0739b8eaf5f5d0ae5f3 /sysdeps/unix/sysv/linux/rseq-internal.h | |
parent | 304221775cd321886d0ca86ac167f7af6913a1ec (diff) | |
download | glibc-be440f6c38ec2cdfd05439d2d90f140da34b8ce6.zip glibc-be440f6c38ec2cdfd05439d2d90f140da34b8ce6.tar.gz glibc-be440f6c38ec2cdfd05439d2d90f140da34b8ce6.tar.bz2 |
nptl: add rtld_hidden_proto to __rseq_size and __rseq_offset
This allows accessing the internal aliases of __rseq_size and
__rseq_offset from ld.so without ifdefs and avoids dynamic symbol
binding at run time for both variables.
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/linux/rseq-internal.h')
-rw-r--r-- | sysdeps/unix/sysv/linux/rseq-internal.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h index 6f56558..3993431 100644 --- a/sysdeps/unix/sysv/linux/rseq-internal.h +++ b/sysdeps/unix/sysv/linux/rseq-internal.h @@ -24,6 +24,7 @@ #include <stdbool.h> #include <stdio.h> #include <sys/rseq.h> +#include <ldsodefs.h> /* Minimum size of the rseq area allocation required by the syscall. The actually used rseq feature size may be less (20 bytes initially). */ @@ -52,19 +53,20 @@ extern unsigned int _rseq_size attribute_hidden; In .data.relro but not yet write-protected. */ extern ptrdiff_t _rseq_offset attribute_hidden; +/* We want to use rtld_hidden_proto in order to call the internal aliases + of __rseq_size and __rseq_offset from ld.so. This avoids dynamic symbol + binding at run time for both variables. */ +rtld_hidden_proto (__rseq_size) +rtld_hidden_proto (__rseq_offset) + #ifdef RSEQ_SIG static inline bool rseq_register_current_thread (struct pthread *self, bool do_rseq) { if (do_rseq) { - unsigned int size; -#if IS_IN (rtld) - /* Use the hidden symbol in ld.so. */ - size = _rseq_size; -#else - size = __rseq_size; -#endif + unsigned int size = __rseq_size; + if (size < RSEQ_AREA_SIZE_INITIAL) /* The initial implementation used only 20 bytes out of 32, but still expected size 32. */ |