about summary refs log tree commit diff
path: root/sysdeps/nptl/dl-tls_init_tp.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-12-09 09:49:32 +0100
committerFlorian Weimer <fweimer@redhat.com>2021-12-09 09:49:32 +0100
commite3e589829d16af9f7e73c7b70f74f3c5d5003e45 (patch)
treef52c82410e4faed193d05dcf28c2586d6f83de16 /sysdeps/nptl/dl-tls_init_tp.c
parent1d350aa06091211863e41169729cee1bca39f72f (diff)
downloadglibc-e3e589829d16af9f7e73c7b70f74f3c5d5003e45.tar.gz
glibc-e3e589829d16af9f7e73c7b70f74f3c5d5003e45.tar.xz
glibc-e3e589829d16af9f7e73c7b70f74f3c5d5003e45.zip
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 'sysdeps/nptl/dl-tls_init_tp.c')
-rw-r--r--sysdeps/nptl/dl-tls_init_tp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c
index fedb876fdb..b39dfbff2c 100644
--- a/sysdeps/nptl/dl-tls_init_tp.c
+++ b/sysdeps/nptl/dl-tls_init_tp.c
@@ -23,6 +23,9 @@
 #include <tls.h>
 #include <rseq-internal.h>
 
+#define TUNABLE_NAMESPACE pthread
+#include <dl-tunables.h>
+
 #ifndef __ASSUME_SET_ROBUST_LIST
 bool __nptl_set_robust_list_avail;
 rtld_hidden_data_def (__nptl_set_robust_list_avail)
@@ -92,7 +95,13 @@ __tls_init_tp (void)
       }
   }
 
-  rseq_register_current_thread (pd);
+  {
+    bool do_rseq = true;
+#if HAVE_TUNABLES
+    do_rseq = TUNABLE_GET (rseq, int, NULL);
+#endif
+    rseq_register_current_thread (pd, do_rseq);
+  }
 
   /* Set initial thread's stack block from 0 up to __libc_stack_end.
      It will be bigger than it actually is, but for unwind.c/pt-longjmp.c