Linux: Perform rseq registration at C startup and thread creation

System Internals / glibc - Mathieu Desnoyers [efficios.com] - 6 July 2020 08:21 UTC

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.

0c76fc3c2b Linux: Perform rseq registration at C startup and thread creation
NEWS | 10 +
elf/dl-tls.c | 8 +-
elf/libc_early_init.c | 4 +
manual/threads.texi | 64 +++++++
nptl/pthread_create.c | 13 ++
sysdeps/generic/rseq-internal.h | 26 +++
sysdeps/unix/sysv/linux/Makefile | 5 +-
sysdeps/unix/sysv/linux/Versions | 1 +
sysdeps/unix/sysv/linux/aarch64/bits/rseq.h | 43 +++++
sysdeps/unix/sysv/linux/aarch64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/alpha/libc.abilist | 1 +
sysdeps/unix/sysv/linux/arm/be/libc.abilist | 1 +
sysdeps/unix/sysv/linux/arm/bits/rseq.h | 83 +++++++++
sysdeps/unix/sysv/linux/arm/le/libc.abilist | 1 +
sysdeps/unix/sysv/linux/bits/rseq.h | 29 +++
sysdeps/unix/sysv/linux/csky/libc.abilist | 1 +
sysdeps/unix/sysv/linux/hppa/libc.abilist | 1 +
sysdeps/unix/sysv/linux/i386/libc.abilist | 1 +
sysdeps/unix/sysv/linux/ia64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist | 1 +
sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist | 1 +
sysdeps/unix/sysv/linux/microblaze/be/libc.abilist | 1 +
sysdeps/unix/sysv/linux/microblaze/le/libc.abilist | 1 +
sysdeps/unix/sysv/linux/mips/bits/rseq.h | 62 +++++++
.../unix/sysv/linux/mips/mips32/fpu/libc.abilist | 1 +
.../unix/sysv/linux/mips/mips32/nofpu/libc.abilist | 1 +
.../unix/sysv/linux/mips/mips64/n32/libc.abilist | 1 +
.../unix/sysv/linux/mips/mips64/n64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/nios2/libc.abilist | 1 +
sysdeps/unix/sysv/linux/powerpc/bits/rseq.h | 37 ++++
.../sysv/linux/powerpc/powerpc32/fpu/libc.abilist | 1 +
.../linux/powerpc/powerpc32/nofpu/libc.abilist | 1 +
.../sysv/linux/powerpc/powerpc64/be/libc.abilist | 1 +
.../sysv/linux/powerpc/powerpc64/le/libc.abilist | 1 +
sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/rseq-internal.h | 73 ++++++++
sysdeps/unix/sysv/linux/rseq-sym.c | 26 +++
sysdeps/unix/sysv/linux/s390/bits/rseq.h | 37 ++++
sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist | 1 +
sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/sh/be/libc.abilist | 1 +
sysdeps/unix/sysv/linux/sh/le/libc.abilist | 1 +
sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist | 1 +
sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/sys/rseq.h | 203 +++++++++++++++++++++
sysdeps/unix/sysv/linux/x86/bits/rseq.h | 30 +++
sysdeps/unix/sysv/linux/x86_64/64/libc.abilist | 1 +
sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist | 1 +
48 files changed, 781 insertions(+), 3 deletions(-)

Upstream: sourceware.org


  • Share