about summary refs log tree commit diff
path: root/nptl
Commit message (Collapse)AuthorAgeFilesLines
...
* nptl: Move pthread_gettattr_np into libcFlorian Weimer2020-05-204-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Use __getline instead of __getdelim to avoid a localplt failure. Likewise for __getrlimit/getrlimit. The abilist updates were performed by: git ls-files 'sysdeps/unix/sysv/linux/**/libc.abilist' \ | while read x ; do echo "GLIBC_2.32 pthread_getattr_np F" >> $x done python3 scripts/move-symbol-to-libc.py --only-linux pthread_getattr_np The private export of __pthread_getaffinity_np is no longer needed, but the hidden alias still necessary so that the symbol can be exported with versioned_symbol. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* nptl: Move pthread_getaffinity_np into libcFlorian Weimer2020-05-204-10/+20
| | | | | | | | | | | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> The abilist updates were performed by: git ls-files 'sysdeps/unix/sysv/linux/**/libc.abilist' \ | while read x ; do echo "GLIBC_2.32 pthread_getaffinity_np F" >> $x done python3 scripts/move-symbol-to-libc.py pthread_getaffinity_np Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* nptl: Move pthread_attr_setaffinity_np into libcFlorian Weimer2020-05-204-10/+29
| | | | | | | | | | | | | | | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> The symbol did not previously exist in libc, so a new GLIBC_2.32 symbol is needed, to get correct dependency for binaries which use the symbol but no longer link against libpthread. The abilist updates were performed by: git ls-files 'sysdeps/unix/sysv/linux/**/libc.abilist' \ | while read x ; do echo "GLIBC_2.32 pthread_attr_setaffinity_np F" >> $x done python3 scripts/move-symbol-to-libc.py pthread_attr_setaffinity_np Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* nptl: Replace some stubs with the Linux implementationFlorian Weimer2020-05-209-30/+626
| | | | | | | | | | | | | The stubs for pthread_getaffinity_np, pthread_getname_np, pthread_setaffinity_np, pthread_setname_np are replaced, and corresponding tests are moved. After the removal of the NaCl port, nptl is Linux-specific, and the stubs are no longer needed. This effectively reverts commit c76d1ff5149bd03210f2bb8cd64446c51618d016 ("NPTL: Add stubs for Linux-only extension functions."). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nptl: wait for pending setxid request also in detached thread (bug 25942)Andreas Schwab2020-05-121-5/+6
| | | | | | | | | | | | | There is a race between __nptl_setxid and exiting detached thread, which causes a deadlock on stack_cache_lock. The deadlock happens in this state: T1: setgroups -> __nptl_setxid (holding stack_cache_lock, waiting on cmdp->cntr == 0) T2 (detached, exiting): start_thread -> __deallocate_stack (waiting on stack_cache_lock) more threads waiting on stack_cache_lock in pthread_create For non-detached threads, start_thread waits for its own setxid handler to finish before exiting. Do this for detached threads as well.
* nptl/tst-setuid1-static: Improve isolation from system objectsFlorian Weimer2020-04-271-0/+5
| | | | | Static dlopen needs an LD_LIBRARY_PATH setting to avoid loading system libraries.
* nptl: Start new threads with all signals blocked [BZ #25098]Florian Weimer2020-04-272-24/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | New threads inherit the signal mask from the current thread. This means that signal handlers can run on the newly created thread immediately after the kernel has created the userspace thread, even before glibc has initialized the TCB. Consequently, new threads can observe uninitialized ctype data, among other things. To address this, block all signals before starting the thread, and pass the original signal mask to the start routine wrapper. On the new thread, first perform all thread initialization, and then unblock signals. The cost of doing this is two rt_sigprocmask system calls on the old thread, and one rt_sigprocmask system call on the new thread. (If there was a way to clone a new thread with a signals disabled, this could be brought down to one system call each.) The thread descriptor increases in size, too, and sigset_t is fairly large. This increase could be brought down by reusing space the in the descriptor which is not needed before running user code, or by switching to an internal sigset_t definition which only covers the signals supported by the kernel definition. (Part of the thread descriptor size increase is already offset by reduced stack usage in the thread start wrapper routine after this commit.) Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* signal: Only handle on NSIG signals on signal functions (BZ #25657)Adhemerval Zanella2020-04-213-5/+66
| | | | | | | | | | | | | | | The upper bits of the sigset_t s not fully initialized in the signal mask calls that return information from kernel (sigprocmask, sigpending, and pthread_sigmask), since the exported sigset_t size (1024 bits) is larger than Linux support one (64 or 128 bits). It might make sigisemptyset/sigorset/sigandset fail if the mask is filled prior the call. This patch changes the internal signal function to handle up to supported Linux signal number (_NSIG), the remaining bits are untouched. Checked on x86_64-linux-gnu and i686-linux-gnu.
* linux: Use pthread_sigmask on sigprocmaskAdhemerval Zanella2020-04-212-0/+3
| | | | | | | With pthread_sigmask on libc.so, it allows implement sigprocmask on top of pthread_sigmask. Checked on x86_64-linux-gnu.
* nptl: Move pthread_sigmask implementation to libcAdhemerval Zanella2020-04-213-4/+14
| | | | | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> A new symbol version is added on libc to force loading failure instead of lazy binding one for newly binaries with old loaders. Checked with a build against all affected ABIs.
* Linux: set_robust_list syscall number is always availableFlorian Weimer2020-03-032-8/+2
| | | | | | | Due to the built-in tables, __NR_set_robust_list is always defined (although it may not be available at run time). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_setschedparam implementation into libcFlorian Weimer2020-02-204-9/+1
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_getschedparam implementation into libcFlorian Weimer2020-02-204-6/+3
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_cond_init implementation into libcFlorian Weimer2020-02-207-20/+8
| | | | | | | | | | | It is necessary to export __pthread_cond_init from libc because the C11 condition variable needs it and is still left in libpthread. This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_cond_destroy implementation into libcFlorian Weimer2020-02-207-19/+13
| | | | | | | | | | | It is necessary to export __pthread_cond_destroy from libc because the C11 condition variable needs it and is still left in libpthread. This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_condattr_init implementation into libcFlorian Weimer2020-02-204-6/+1
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_condattr_destroy implementation into libcFlorian Weimer2020-02-204-4/+3
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_setscope implementation into libcFlorian Weimer2020-02-204-8/+1
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_getscope implementation into libcFlorian Weimer2020-02-204-5/+3
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_setschedpolicy implementation into libcFlorian Weimer2020-02-204-6/+1
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move pthread_attr_getschedpolicy implementation into libcFlorian Weimer2020-02-204-5/+3
| | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Sort routines list in Makefile alphabeticallyFlorian Weimer2020-02-201-7/+21
| | | | | | | This will make it easier to review changes which move implementations from libpthread to libc. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Use .NOTPARALLEL in Makefile only if actually running testsFlorian Weimer2020-02-201-1/+3
| | | | | | It is safe to build the tests in parallel. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Block all signals on timer_create thread (BZ#10815)Adhemerval Zanella2020-02-192-1/+83
| | | | | | | | | | | | | | | | | | | | The behavior of the signal mask on threads created by timer_create for SIGEV_THREAD timers are implementation-defined and glibc explicit unblocks all signals before calling the user-defined function. This behavior, although not incorrect standard-wise, opens a race if a program using a blocked rt-signal plus sigwaitinfo (and without an installed signal handler for the rt-signal) receives a signal while executing the used-defined function for SIGEV_THREAD. A better alternative discussed in bug report is to rather block all signals (besides the internal ones not available to application usage). This patch fixes this issue by only unblocking SIGSETXID (used on set*uid function) and SIGCANCEL (used for thread cancellation). Checked on x86_64-linux-gnu and i686-linux-gnu.
* Introduce <elf-initfini.h> and ELF_INITFINI for all architecturesFlorian Weimer2020-02-181-3/+10
| | | | | | | | | | | | | | | | This supersedes the init_array sysdeps directory. It allows us to check for ELF_INITFINI in both C and assembler code, and skip DT_INIT and DT_FINI processing completely on newer architectures. A new header file is needed because <dl-machine.h> is incompatible with assembler code. <sysdep.h> is compatible with assembler code, but it cannot be included in all assembler files because on some architectures, it redefines register names, and some assembler files conflict with that. <elf-initfini.h> is replicated for legacy architectures which need DT_INIT/DT_FINI support. New architectures follow the generic default and disable it.
* pthread: Fix building tst-robust8 with nptlSamuel Thibault2020-02-161-2/+2
| | | | NPTL's pthreadP.h needs internal definitions
* pthread: Move robust mutex tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-1612-1059/+3
| | | | | tst-robust8.c prints some mutex internals for nptl debugging, this needed to be made conditioned by getting built with nptl.
* linux: Remove INTERNAL_SYSCALL_DECLAdhemerval Zanella2020-02-147-50/+32
| | | | | | | | | | | With all Linux ABIs using the expected Linux kABI to indicate syscalls errors, the INTERNAL_SYSCALL_DECL is an empty declaration on all ports. This patch removes the 'err' argument on INTERNAL_SYSCALL* macro and remove the INTERNAL_SYSCALL_DECL usage. Checked with a build against all affected ABIs.
* nptl: Remove ununsed pthread-errnos.h ruleAdhemerval Zanella2020-02-142-15/+1
|
* pthread: Move some join tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-1013-521/+8
| | | | So they can be checked with htl too.
* pthread: Move most barrier tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-105-530/+0
| | | | So they can be checked with htl too.
* pthread: Move most sem tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-1013-1197/+1
| | | | So they can be checked with htl too.
* pthread: Move key tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-105-497/+0
| | | | So they can be checked with htl too.
* pthread: Move some rwlock tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-098-1109/+4
| | | | So they can be checked with htl too.
* pthread: Move most once tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-097-524/+2
| | | | So they can be checked with htl too.
* pthread: Move most cond tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-0929-3772/+3
| | | | So they can be checked with htl too.
* pthread: Move some attr tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-092-306/+1
| | | | So they can be checked with htl too.
* pthread: Move most mutex tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-098-1463/+1
| | | | | | So they can be checked with htl too. XFAIL tst-mutex4, for which support is still missing in htl.
* pthread: Move spin tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-095-376/+0
| | | | So they can be checked with htl too.
* pthread: Move basic tests from nptl to sysdeps/pthreadSamuel Thibault2020-02-098-669/+0
| | | | So they can be checked with htl too.
* C11 threads: Move implementation to sysdeps/pthreadSamuel Thibault2020-02-0936-1538/+3
| | | | | | | so it gets shared by nptl and htl. Also add htl versions of thrd_current and thrd_yield. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* C11 threads: make thrd_join more portableSamuel Thibault2020-02-091-1/+1
| | | | | | | by making a __pthread_join call instead of an equivalent __pthread_clockjoin_ex call. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* C11 threads: Fix thrd_t / pthread_t compatibility assertionSamuel Thibault2020-02-091-2/+2
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* C11 threads: do not require PTHREAD_DESTRUCTOR_ITERATIONSSamuel Thibault2020-02-091-0/+2
| | | | | | It is optional in POSIX. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move nptl-specific types to separate headerSamuel Thibault2020-02-091-1/+1
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Run nptl/tst-pthread-getattr in a containerDJ Delorie2020-02-031-2/+4
| | | | | | | | | | | | | | See https://bugzilla.redhat.com/show_bug.cgi?id=1653942 This test depends on the kernel's assignment of memory regions, but running under ld.so explicitly changes those assignments, sometimes sufficiently to cause the test to fail (esp with address space randomization). The easiest way to "fix" the test, is to run it the way the user would - without ld.so. Running it in a container does that. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update copyright dates not handled by scripts/update-copyrights.Joseph Myers2020-01-011-1/+1
| | | | | | | | | | | | | | | I've updated copyright dates in glibc for 2020. This is the patch for the changes not generated by scripts/update-copyrights and subsequent build / regeneration of generated files. As well as the usual annual updates, mainly dates in --version output (minus libc.texinfo which previously had to be handled manually but is now successfully updated by update-copyrights), there is a fix to sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h where a typo in the copyright notice meant it failed to be updated automatically. Please remember to include 2020 in the dates for any new files added in future (which means updating any existing uncommitted patches you have that add new files to use the new copyright dates in them).
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-01493-493/+493
|
* nptl: Move waitpid implementation to libcAdhemerval Zanella2019-12-192-3/+2
| | | | Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.
* nptl: Move wait implementation to libcAdhemerval Zanella2019-12-192-3/+2
| | | | Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.