1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Linux: Perform rseq registration at C startup and thread creation

Register rseq TLS for each thread (including main), and unregister for
each thread (excluding main).  "rseq" stands for Restartable Sequences.

See the rseq(2) man page proposed here:
  https://lkml.org/lkml/2018/9/19/647

Those are based on glibc master branch commit 3ee1e0ec5c.
The rseq system call was merged into Linux 4.18.

The TLS_STATIC_SURPLUS define is increased to leave additional room for
dlopen'd initial-exec TLS, which keeps elf/tst-auditmany working.

The increase (76 bytes) is larger than 32 bytes because it has not been
increased in quite a while.  The cost in terms of additional TLS storage
is quite significant, but it will also obscure some initial-exec-related
dlopen failures.
This commit is contained in:
Mathieu Desnoyers
2020-07-06 10:21:16 +02:00
committed by Florian Weimer
parent f9cf873537
commit 0c76fc3c2b
48 changed files with 781 additions and 3 deletions

View File

@ -18,10 +18,14 @@
#include <ctype.h>
#include <libc-early-init.h>
#include <rseq-internal.h>
void
__libc_early_init (_Bool initial)
{
/* Initialize ctype data. */
__ctype_init ();
/* Register rseq ABI to the kernel for the main program's libc. */
if (initial)
rseq_register_current_thread ();
}