diff options
| author | Michael Jeanson <mjeanson@efficios.com> | 2024-07-10 15:37:28 -0400 |
|---|---|---|
| committer | Michael Jeanson <mjeanson@efficios.com> | 2025-01-10 20:19:07 +0000 |
| commit | c813c1490d5d8640a94fced10fc7674a48737b96 (patch) | |
| tree | 36b9f24bfee314322a72de8b0077b324dbb64055 /sysdeps/nptl | |
| parent | 4a9a8a50981e2a3e0a04ef4c7ad7c26807c18161 (diff) | |
| download | glibc-c813c1490d5d8640a94fced10fc7674a48737b96.tar.xz glibc-c813c1490d5d8640a94fced10fc7674a48737b96.zip | |
nptl: Add rseq auxvals
Get the rseq feature size and alignment requirement from the auxiliary
vector for use inside the dynamic loader. Use '__rseq_size' directly to
store the feature size. If the main thread registration fails or is
disabled by tunable, reset the value to 0.
This will be used in the TLS block allocator to compute the size and
alignment of the rseq area block for the extended ABI support.
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/nptl')
| -rw-r--r-- | sysdeps/nptl/dl-tls_init_tp.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c index c57738e9f3..46478324fc 100644 --- a/sysdeps/nptl/dl-tls_init_tp.c +++ b/sysdeps/nptl/dl-tls_init_tp.c @@ -46,6 +46,8 @@ rtld_mutex_dummy (pthread_mutex_t *lock) const unsigned int __rseq_flags; +size_t _rseq_align attribute_hidden; + void __tls_pre_init_tp (void) { @@ -99,10 +101,14 @@ __tls_init_tp (void) } { - bool do_rseq = true; - do_rseq = TUNABLE_GET (rseq, int, NULL); - if (rseq_register_current_thread (pd, do_rseq)) - _rseq_size = RSEQ_AREA_SIZE_INITIAL_USED; + /* If the registration fails or is disabled by tunable, the public + '__rseq_size' will be set to '0' regardless of the feature size of the + allocated rseq area. An rseq area of at least 32 bytes is always + allocated since application code is allowed to check the status of the + rseq registration by reading the content of the 'cpu_id' field. */ + bool do_rseq = TUNABLE_GET (rseq, int, NULL); + if (!rseq_register_current_thread (pd, do_rseq)) + _rseq_size = 0; #ifdef RSEQ_SIG /* This should be a compile-time constant, but the current |
