1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-01 10:06:57 +03:00

nptl: Move part of TCB initialization from libpthread to __tls_init_tp

This initalization should only happen once for the main thread's TCB.
At present, auditors can achieve this by not linking against
libpthread.  If libpthread becomes part of libc, doing this
initialization in libc would happen for every audit namespace,
or too late (if it happens from the main libc only).  That's why
moving this code into ld.so seems the right thing to do, right after
the TCB initialization.

For !__ASSUME_SET_ROBUST_LIST ports, this also moves the symbol
__set_robust_list_avail into ld.so, as __nptl_set_robust_list_avail.
It also turned into a proper boolean flag.

Inline the __pthread_initialize_pids function because it seems no
longer useful as a separate function.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
This commit is contained in:
Florian Weimer
2021-04-21 19:49:51 +02:00
parent 90d7e7e5bd
commit 442e8a40da
8 changed files with 52 additions and 97 deletions

View File

@ -224,8 +224,10 @@ extern unsigned int __nptl_nthreads;
libc_hidden_proto (__nptl_nthreads)
#ifndef __ASSUME_SET_ROBUST_LIST
/* Negative if we do not have the system call and we can use it. */
extern int __set_robust_list_avail attribute_hidden;
/* True if the set_robust_list system call works. Initialized in
__tls_init_tp. */
extern bool __nptl_set_robust_list_avail;
rtld_hidden_proto (__nptl_set_robust_list_avail)
#endif
/* Thread Priority Protection. */