summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* nptl: Remove remnants of the libc/libpthread forwarder interfacefw/libpthread-20210318bFlorian Weimer2021-03-187-147/+10
| | | | All previously forwarded functions are now implemented in libc.
* nptl: Move setxid broadcast implementation into libcFlorian Weimer2021-03-189-285/+287
| | | | | | | The signal handler is exported as __nptl_setxid_sighandler, so that the libpthread initialization code can install it. This is sufficient for now because it is guarantueed to happen before the first pthread_create call.
* nptl: Move core condition variable functions into libcFlorian Weimer2021-03-1875-346/+176
| | | | | | | | | | | | | Onl pthread_cond_clockwait did not have a forwarder, so it needs a new symbol version. Some complications arise due to the need to supply hidden aliases, GLIBC_PRIVATE exports (for the C11 condition variable implementation that still remains in libpthread) and 64-bit time_t stubs. pthread_cond_broadcast, pthread_cond_signal, pthread_cond_timedwait, pthread_cond_wait, pthread_cond_clockwait have been moved using scripts/move-symbol-to-libc.py.
* nptl: Move core mutex functions into libcFlorian Weimer2021-03-1873-308/+346
| | | | | | | | | | | | This is complicated because of a second compilation of nptl/pthread_mutex_lock.c via nptl/pthread_mutex_cond_lock.c. PTHREAD_MUTEX_VERSIONS is introduced to suppress symbol versions in that case. The symbols __pthread_mutex_lock, __pthread_mutex_unlock, __pthread_mutex_init, __pthread_mutex_destroy, pthread_mutex_lock, pthread_mutex_unlock, pthread_mutex_init, pthread_mutex_destroy have beeb moved using scripts/move-symbol-to-libc.py.
* x86: Remove low-level lock optimizationFlorian Weimer2021-03-183-89/+0
| | | | | | | | | | | | | The current approach is to do this optimizations at a higher level, in generic code, so that single-threaded cases can be specifically targeted. Furthermore, using IS_IN (libc) as a compile-time indicator that all locks are private is no longer correct once process-shared lock implementations are moved into libc. The generic <lowlevellock.h> is not compatible with assembler code (obviously), so it's necessary to remove two long-unused #includes.
* nptl: pthread_mutex_lock, pthread_mutex_unock single-threaded optimizationFlorian Weimer2021-03-183-4/+39
| | | | | | | This is optimization is similar in spirit to the SINGLE_THREAD_P check in the malloc implementation. Doing this in generic code allows us to prioritize those cases which are likely to occur in single-threaded programs (normal and recursive mutexes).
* nptl: Move internal symbol __mutex_aconf into libcFlorian Weimer2021-03-187-6/+72
| | | | | | | This is in preparation of moving the mutex code into libc. __pthread_tunables_init is now called via __libc_early_init. For non-NPTL targets, a stub version is provided.
* pthread: Introduce __pthread_early_initFlorian Weimer2021-03-182-0/+32
| | | | | This function is called from __libc_early_init to initialize the pthread subsystem.
* nptl: Move the internal thread priority protection symbols into libcFlorian Weimer2021-03-184-9/+22
| | | | This is a prerequisite for moving the mutex implementation.
* nptl: Move rwlock functions with forwarders into libcFlorian Weimer2021-03-1870-215/+466
| | | | | | | | | | | | The forwarders were only used internally, so new symbol versions are needed. All symbols are moved at once because the forwarders are no-ops if libpthread is not loaded, leading to inconsistencies in case of a partial migration. The symbols __pthread_rwlock_rdlock, __pthread_rwlock_unlock, __pthread_rwlock_wrlock, pthread_rwlock_rdlock, pthread_rwlock_unlock, pthread_rwlock_wrlock have been moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_key_delete into libc.Florian Weimer2021-03-1865-34/+83
| | | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. tss_delete (still in libpthread) uses the __pthread_key_create alias, so that is now exported under GLIBC_PRIVATE.
* nptl: Move pthread_setspecific, __pthread_setspecific into libcFlorian Weimer2021-03-1868-70/+152
| | | | The symbols have been moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_getspecific, __pthread_getspecific into libcFlorian Weimer2021-03-1868-70/+152
| | | | The symbols have been moved using scripts/move-symbol-to-libc.py.
* nptl: Move pthread_key_create, __pthread_key_create into libcFlorian Weimer2021-03-1868-70/+150
| | | | The symbols have been moved using scripts/move-symbol-to-libc.py.
* nptl: Move part of TCB initialization from libpthread to __tls_init_tpFlorian Weimer2021-03-188-97/+52
| | | | | | | | | | | | | | | | | 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.
* elf: Introduce __tls_init_tp for second-phase TCB initializationFlorian Weimer2021-03-186-20/+63
| | | | | | | | TLS_INIT_TP is processor-specific, so it is not a good place to put thread library initialization code (it would have to be repeated for all CPUs). Introduce __tls_init_tp as a separate function, to be called immediately after TLS_INIT_TP. Move the existing stack list setup code for NPTL to this function.
* Remove pthread_key_create-related internals from libc-lock.hFlorian Weimer2021-03-183-49/+0
| | | | | And libc-lockP.h. This is no longer used because all internal TLS use goes directly to the thread descriptor/TCB or uses ELF TLS.
* dlfcn: dlerror needs to call free from the base namespace [BZ #24773]Florian Weimer2021-03-1814-227/+307
| | | | | | | | | | | | Calling free directly may end up freeing a pointer allocated by the dynamic loader using malloc from libc.so in the base namespace using the allocator from libc.so in a secondary namespace, which results in crashes. This commit redirects the free call through GLRO and the dynamic linker, to reach the correct namespace. It also cleans up the dlerror handling along the way, so that pthread_setspecific is no longer needed (which avoids triggering bug 24774).
* dlfcn: Failures after dlmopen should not terminate process [BZ #24772]Florian Weimer2021-03-187-3/+111
| | | | | | | | | | | | | | | | | Commit 9e78f6f6e7134a5f299cc8de77370218f8019237 ("Implement _dl_catch_error, _dl_signal_error in libc.so [BZ #16628]") has the side effect that distinct namespaces, as created by dlmopen, now have separate implementations of the rtld exception mechanism. This means that the call to _dl_catch_error from libdl in a secondary namespace does not actually install an exception handler because the thread-local variable catch_hook in the libc.so copy in the secondary namespace is distinct from that of the base namepace. As a result, a dlsym/dlopen/... failure in a secondary namespace terminates the process with a dynamic linker error because it looks to the exception handler mechanism as if no handler has been installed. This commit restores GLRO (dl_catch_error) and uses it to set the handler in the base namespace.
* nptl: Invoke the set_robust_list system call directly in forkFlorian Weimer2021-03-183-31/+2
| | | | | | This removes one of the pthread forwarder functions. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_setcanceltype into libcFlorian Weimer2021-03-1836-36/+4
| | | | | | | | No new symbol version is required because there was a forwarder. The symbol has been moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_setcancelstate into libcFlorian Weimer2021-03-1843-77/+21
| | | | | | | | No new symbol version is required because there was a forwarder. The symbol has been moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_exit into libcFlorian Weimer2021-03-1839-55/+66
| | | | | | | | | | | | | | The pthread_exit symbol was moved using scripts/move-symbol-to-libc.py. No new symbol version is needed because there was a forwarder. The new tests nptl/tst-pthread_exit-nothreads and nptl/tst-pthread_exit-nothreads-static exercise the scenario that pthread_exit is called without libpthread having been linked in. This is not possible for the generic code, so these tests do not live in sysdeps/pthread for now. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move __nptl_deallocate_tsd into libcFlorian Weimer2021-03-188-102/+116
| | | | | | | This prepares moving pthread_exit, and later the pthread_key_create infrastructure. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move __pthread_keys global variable into libcFlorian Weimer2021-03-186-7/+28
| | | | | | | This prepares moving pthread_exit, and later the pthread_key_create infrastructure. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl_db: Introduce DB_MAIN_ARRAY_VARIABLEFlorian Weimer2021-03-182-0/+6
| | | | | | And document the reason for DB_ARRAY_VARIABLE. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move internal __nptl_nthreads variable into libcFlorian Weimer2021-03-1810-21/+30
|
* csu: Move calling main out of __libc_start_main_implFlorian Weimer2021-03-183-70/+116
| | | | | | | This code depends on whether glibc has unwinding support for a particular port. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move __pthread_unwind_next into libcFlorian Weimer2021-03-1880-176/+122
| | | | | | | | | | | | | | | | | | | It's necessary to stub out __libc_disable_asynccancel and __libc_enable_asynccancel via rtld-stubbed-symbols because the new direct references to the unwinder result in symbol conflicts when the rtld exception handling from libc is linked in during the construction of librtld.map. unwind-forcedunwind.c is merged into unwind-resume.c. libc now needs the functions that were previously only used in libpthread. The GLIBC_PRIVATE exports of __libc_longjmp and __libc_siglongjmp are no longer needed, so switch them to hidden symbols. The symbol __pthread_unwind_next has been moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_once and __pthread_once into libcFlorian Weimer2021-03-1871-97/+158
| | | | | | | | | | | And also the fork generation counter, __fork_generation. This eliminates the need for __fork_generation_pointer. call_once remains in libpthread and calls the exported __pthread_once symbol. pthread_once and __pthread_once have been moved using scripts/move-symbol-to-libc.py.
* nptl: Move __pthread_cleanup_upto into libcFlorian Weimer2021-03-188-18/+8
| | | | | | | | This internal symbol is used as part of the longjmp implementation. Rename the file from nptl/pt-cleanup.c to nptl/pthread_cleanup_upto.c so that the pt-* files remain restricted to libpthread. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* x86: Restore compile-time check for shadow stack pointer in longjmpAdhemerval Zanella2021-03-181-0/+39
|
* nptl: Remove longjmp, siglongjmp from libpthreadFlorian Weimer2021-03-1833-276/+28
| | | | | | | | | | | | | | The definitions in libc are sufficient, the forwarders are no longer needed. The symbols have been moved using scripts/move-symbol-to-libc.py. s390-linux-gnu and s390x-linux-gnu need a new version placeholder to keep the GLIBC_2.19 symbol version in libpthread. Tested on i386-linux-gnu, powerpc64le-linux-gnu, s390x-linux-gnu, x86_64-linux-gnu. Built with build-many-glibcs.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move legacy cancelation handling into libc as compat symbolsFlorian Weimer2021-03-1868-146/+186
| | | | | | | | | | | | | | | This affects _pthread_cleanup_pop, _pthread_cleanup_pop_restore, _pthread_cleanup_push, _pthread_cleanup_push_defer. The symbols have been moved using scripts/move-symbol-to-libc.py. No new symbol versions are added because the symbols are turned into compatibility symbols at the same time. __pthread_cleanup_pop and __pthread_cleanup_push are added as GLIBC_PRIVATE symbols because they are also used internally, for glibc's own cancellation handling. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move legacy unwinding implementation into libcFlorian Weimer2021-03-187-116/+97
| | | | | | | | | | | | It is still used internally. Since unwinding is now available unconditionally, avoid indirect calls through function pointers loaded from the stack by inlining the non-cancellation cleanup code. This avoids a regression in security hardening. The out-of-line __libc_cleanup_routine implementation is no longer needed because the inline definition is now static __always_inline. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move __pthread_cleanup_routine into libcFlorian Weimer2021-03-1864-33/+77
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_mutex_consistent into libcFlorian Weimer2021-03-1869-72/+141
| | | | | | And deprecated pthread_mutex_consistent_np, its old name. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* support: Use syscall function instead of INLINE_SYSCALL_CALLAdhemerval Zanella2021-03-181-1/+1
| | | | | It fixes the build on ARM in thumb mode that requires an out of the line helper (__libc_do_syscall) to issue the syscall.
* signal: Add __libc_sigactionAdhemerval Zanella2021-03-1814-23/+48
| | | | | | | | The generic implementation basically handle the system agnostic logic (filtering out the invalid signals) while the __libc_sigaction is the function with implements the system and architecture bits. Checked on x86_64-linux-gnu and i686-linux-gnu.
* nptl: Move system to libcAdhemerval Zanella2021-03-1828-74/+0
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Move fcntl from libpthreadAdhemerval Zanella2021-03-1829-106/+0
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove sendmsg from libpthreadAdhemerval Zanella2021-03-1832-32/+1
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove recvmsg from libpthreadAdhemerval Zanella2021-03-1832-32/+2
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove sigwait from libpthreadAdhemerval Zanella2021-03-1831-31/+1
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove tcdrain from libpthreadAdhemerval Zanella2021-03-1831-32/+1
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove pause from libpthreadAdhemerval Zanella2021-03-1831-32/+1
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove msync from libpthreadAdhemerval Zanella2021-03-1831-32/+1
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove fsync from libpthreadAdhemerval Zanella2021-03-1831-32/+1
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove sendto from libpthreadAdhemerval Zanella2021-03-1832-32/+2
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
* nptl: Remove recvfrom from libpthreadAdhemerval Zanella2021-03-1832-32/+2
| | | | | | The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.