1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

nptl: Add glibc.pthread.rseq tunable to control rseq registration

This tunable allows applications to register the rseq area instead
of glibc.

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This commit is contained in:
Florian Weimer
2021-12-09 09:49:32 +01:00
parent 1d350aa060
commit e3e589829d
8 changed files with 145 additions and 9 deletions

View File

@ -21,22 +21,27 @@
#include <sysdep.h>
#include <errno.h>
#include <kernel-features.h>
#include <stdbool.h>
#include <stdio.h>
#include <sys/rseq.h>
#ifdef RSEQ_SIG
static inline void
rseq_register_current_thread (struct pthread *self)
rseq_register_current_thread (struct pthread *self, bool do_rseq)
{
int ret = INTERNAL_SYSCALL_CALL (rseq,
&self->rseq_area, sizeof (self->rseq_area),
0, RSEQ_SIG);
if (INTERNAL_SYSCALL_ERROR_P (ret))
THREAD_SETMEM (self, rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED);
if (do_rseq)
{
int ret = INTERNAL_SYSCALL_CALL (rseq, &self->rseq_area,
sizeof (self->rseq_area),
0, RSEQ_SIG);
if (!INTERNAL_SYSCALL_ERROR_P (ret))
return;
}
THREAD_SETMEM (self, rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED);
}
#else /* RSEQ_SIG */
static inline void
rseq_register_current_thread (struct pthread *self)
rseq_register_current_thread (struct pthread *self, bool do_rseq)
{
THREAD_SETMEM (self, rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED);
}