diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-12-09 09:49:32 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-12-09 09:49:32 +0100 |
commit | e3e589829d16af9f7e73c7b70f74f3c5d5003e45 (patch) | |
tree | f52c82410e4faed193d05dcf28c2586d6f83de16 /nptl | |
parent | 1d350aa06091211863e41169729cee1bca39f72f (diff) | |
download | glibc-e3e589829d16af9f7e73c7b70f74f3c5d5003e45.zip glibc-e3e589829d16af9f7e73c7b70f74f3c5d5003e45.tar.gz glibc-e3e589829d16af9f7e73c7b70f74f3c5d5003e45.tar.bz2 |
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>
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/pthread_create.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index ea0d793..4608fd9 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -368,7 +368,10 @@ start_thread (void *arg) __ctype_init (); /* Register rseq TLS to the kernel. */ - rseq_register_current_thread (pd); + { + bool do_rseq = THREAD_GETMEM (pd, flags) & ATTR_FLAG_DO_RSEQ; + rseq_register_current_thread (pd, do_rseq); + } #ifndef __ASSUME_SET_ROBUST_LIST if (__nptl_set_robust_list_avail) @@ -677,6 +680,11 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr, pd->flags = ((iattr->flags & ~(ATTR_FLAG_SCHED_SET | ATTR_FLAG_POLICY_SET)) | (self->flags & (ATTR_FLAG_SCHED_SET | ATTR_FLAG_POLICY_SET))); + /* Inherit rseq registration state. Without seccomp filters, rseq + registration will either always fail or always succeed. */ + if ((int) THREAD_GETMEM_VOLATILE (self, rseq_area.cpu_id) >= 0) + pd->flags |= ATTR_FLAG_DO_RSEQ; + /* Initialize the field for the ID of the thread which is waiting for us. This is a self-reference in case the thread is created detached. */ |