about summary refs log tree commit diff
path: root/nptl
Commit message (Collapse)AuthorAgeFilesLines
* nptl: Move futex-internal into libcFlorian Weimer2021-02-223-5/+5
| | | | | | | | This moves __futex_abstimed_wait64 and __futex_abstimed_wait_cancelable64 and exports these functions as GLIBC_PRIVATE. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Move lowlevellock into libc [BZ #15648]Florian Weimer2021-02-224-26/+5
| | | | | | And export __lll_lock_wait and __lll_lock_wait_private as GLIBC_PRIVATE. This should eliminate the need for the previous riscv kludge.
* nptl: Move futex-internal.c into main nptl directoryFlorian Weimer2021-02-222-0/+129
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Reformat VersionsFlorian Weimer2021-02-221-188/+279
| | | | | | One symbol per line, lexicographically ordered. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Split libpthread-routines into one routine per lineFlorian Weimer2021-02-221-86/+152
| | | | | | | And sort the lines lexicographically. This will make it easier to review patches which move symbols from libpthread to libc. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* pthread: Refactor semaphore codeAdhemerval Zanella2021-02-082-22/+1
| | | | | | | | | | | The internal semaphore list code is moved to a specific file, sem_routine.c, and the internal usage is simplified to only two functions (one to insert a new semaphore and one to remove it from the internal list). There is no need to expose the internal locking, neither how the semaphore mapping is implemented. No functional or semantic change is expected, tested on x86_64-linux-gnu.
* linux: Require /dev/shm as the shared memory file systemFlorian Weimer2021-02-084-4/+0
| | | | | | | | | | | | | | | | | | | | | Previously, glibc would pick an arbitrary tmpfs file system from /proc/mounts if /dev/shm was not available. This could lead to an unsuitable file system being picked for the backing storage for shm_open, sem_open, and related functions. This patch introduces a new function, __shm_get_name, which builds the file name under the appropriate (now hard-coded) directory. It is called from the various shm_* and sem_* function. Unlike the SHM_GET_NAME macro it replaces, the callers handle the return values and errno updates. shm-directory.c is moved directly into the posix subdirectory because it can be implemented directly using POSIX functionality. It resides in libc because it is needed by both librt and nptl/htl. In the sem_open implementation, tmpfname is initialized directly from a string constant. This happens to remove one alloca call. Checked on x86_64-linux-gnu.
* nptl: Fix comment typo in pthread_cond_wait.cJangwoong Kim2021-01-041-1/+1
|
* nptl: Remove set*id, set*gid files which are not builtFlorian Weimer2021-01-049-28/+0
|
* Update copyright dates not handled by scripts/update-copyrights.Paul Eggert2021-01-021-1/+1
| | | | | | | | | | | | | | I've updated copyright dates in glibc for 2021. 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 csu/version.c which previously had to be handled manually but is now successfully updated by update-copyrights), there is a small change to the copyright notice in NEWS which should let NEWS get updated automatically next year. Please remember to include 2021 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-copyrightsPaul Eggert2021-01-02280-280/+280
| | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
* {nptl,htl}/semaphoreP.h: clean upSamuel Thibault2020-12-161-2/+2
| | | | | This removes "Contributed by", and uses a C99 flexible array instead of char name[0];
* htl: Get sem_open/sem_close/sem_unlink support [BZ #25524]Samuel Thibault2020-12-163-439/+0
| | | | | This just moves the existing nptl implementation to reuse as it is in htl.
* pthread: Move semaphore initialization for open to semaphoreP.hSamuel Thibault2020-12-162-11/+16
| | | | | This allows to easily reuse all of the sem_open/sem_close/sem_unlink implementations in the various ports.
* nptl: Fix __futex_clocklock64 return error check [BZ #26964]Lucas A. M. Magalhaes2020-12-012-1/+139
| | | | | | | | | | | | | | | | | The earlier implementation of this, __lll_clocklock, calls lll_clockwait that doesn't return the futex syscall error codes. It always tries again if that fails. However in the current implementation, when the futex returns EAGAIN, __futex_clocklock64 will also return EGAIN, even if the futex is taken. This patch fixes the EAGAIN issue and also adds a check for EINTR. As futex syscall can return EINTR if the thread is interrupted by a signal. In this case I'm assuming the function should continue trying to lock as there is no mention to about it on POSIX. Also add a test for both scenarios. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: Convert aio_suspend to support 64 bit timeLukasz Majewski2020-11-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The aio_suspend function has been converted to support 64 bit time. This change uses (in aio_misc.h): - __futex_abstimed_wait64 (instead of futex_reltimed_wait) - __futex_abstimed_wait_cancellable64 (instead of futex_reltimed_wait_cancellable) from ./sysdeps/nptl/futex-helpers.h The aio_suspend() accepts relative timeout, which then is converted to absolute one. The i686-gnu port (HURD) do not define DONT_NEED_AIO_MISC_COND and as it doesn't (yet) support 64 bit time it uses not converted pthread_cond_timedwait(). The __aio_suspend() is supposed to be run on ports with __TIMESIZE !=64 and __WORDSIZE==32. It internally utilizes __aio_suspend_time64() and hence the conversion from 32 bit struct timespec to 64 bit one is required. For ports supporting 64 bit time the __aio_suspend_time64() will be used either via alias (to __aio_suspend when __TIMESIZE==64) or redirection (when -D_TIME_BITS=64 is passed). Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Add EOVERFLOW checks for futex callsAdhemerval Zanella2020-11-274-13/+13
| | | | | | | | | | | | | | | | | | | | | Some futex-internal calls require additional check for EOVERFLOW (as indicated by [1] [2] [3]). For both mutex and rwlock code, EOVERFLOW is handle as ETIMEDOUT; since it indicate to the caller that the blocking operation could not be issued. For mutex it avoids a possible issue where PTHREAD_MUTEX_ROBUST_* might assume EOVERFLOW indicate futex has succeed, and for PTHREAD_MUTEX_PP_* it avoid a potential busy infinite loop. For rwlock and semaphores, it also avoids potential busy infinite loops. Checked on x86_64-linux-gnu and i686-linux-gnu, although EOVERFLOW won't be possible with current usage (since all timeouts on 32-bit architectures with 32-bit time_t support will be in the range of 32-bit time_t). [1] https://sourceware.org/pipermail/libc-alpha/2020-November/120079.html [2] https://sourceware.org/pipermail/libc-alpha/2020-November/120080.html [3] https://sourceware.org/pipermail/libc-alpha/2020-November/120127.html
* nptl: Fix PTHREAD_PRIO_PROTECT timed lockAdhemerval Zanella2020-11-274-25/+11
| | | | | | | | | | | | | | | | | The 878fe624d4 changed lll_futex_timed_wait, which expects a relative timeout, with a __futex_abstimed_wait64, which expects an absolute timeout. However the code still passes a relative timeout. Also, the PTHREAD_PRIO_PROTECT support for clocks different than CLOCK_REALTIME was broken since the inclusion of pthread_mutex_clocklock (9d20e22e46) since lll_futex_timed_wait always use CLOCK_REALTIME. This patch fixes by removing the relative time calculation. It also adds some xtests that tests both thread and inter-process usage. Checked on x86_64-linux-gnu.
* nptl: Return EINVAL for invalid clock for pthread_clockjoin_npAdhemerval Zanella2020-11-251-0/+4
| | | | | | | | | The align the GNU extension with the others one that accept specify which clock to wait for (such as pthread_mutex_clocklock). Check on x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Return EINVAL for pthread_mutex_clocklock/PI with CLOCK_MONOTONIC [BZ ↵Adhemerval Zanella2020-11-253-1/+76
| | | | | | | | | | | | | | | | #26801] Linux futex FUTEX_LOCK_PI operation only supports CLOCK_REALTIME, so pthread_mutex_clocklock operation with priority aware mutexes may fail depending of the input timeout. Also, it is not possible to convert a CLOCK_MONOTONIC to a CLOCK_REALTIME due the possible wall clock time change which might invalid the requested timeout. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Replace lll_futex_wake with futex-internal.hAdhemerval Zanella2020-11-253-12/+7
| | | | | | | | | The idea is to make NPTL implementation to use on the functions provided by futex-internal.h. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Replace lll_futex_supported_clockid with futex-internal.hAdhemerval Zanella2020-11-251-1/+1
| | | | | | | | | The idea is to make NPTL implementation to use on the functions provided by futex-internal.h. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Replace lll_futex_{timed_}wait by futex-internal.hAdhemerval Zanella2020-11-254-12/+14
| | | | | | | | | The idea is to make NPTL implementation to use on the functions provided by futex-internal.h. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Replace lll_timedwait with __futex_abstimed_wait64Adhemerval Zanella2020-11-253-65/+2
| | | | | | Checked with x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Replace __futex_clocklock_wait64 with __futex_abstimed_wait64Adhemerval Zanella2020-11-251-2/+2
| | | | | | | | | | | | | | | | | For non null timeouts, the __futex_clocklock_wait64 creates an a relative timeout by subtracting the current time from the input argument. The same behavior can be obtained with FUTEX_WAIT_BITSET without the need to calculate the relative timeout. Besides consolidate the code it also avoid the possible relative timeout issues [1]. The __futex_abstimed_wait64 needs also to return EINVAL syscall errors. Checked on x86_64-linux-gnu and i686-linux-gnu. [1] https://sourceware.org/pipermail/libc-alpha/2020-November/119881.html Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Remove _futex_clock_wait_bitset64Adhemerval Zanella2020-11-251-3/+4
| | | | | | | | It can be replaced with a __futex_abstimed_wait64 call. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Remove clockwait_tidAdhemerval Zanella2020-11-251-58/+18
| | | | | | | | | | | It can be replaced with a __futex_abstimed_wait_cancelable64 call, with the advantage that there is no need to further clock adjustments to create a absolute timeout. It allows to remove the now ununsed futex_timed_wait_cancel64 internal function. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Remove futex_wait_cancelableAdhemerval Zanella2020-11-251-20/+2
| | | | | | | | | It is used solely on __pthread_cond_wait_common and the call can be replaced by a __futex_abstimed_wait_cancelable64 one. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Remove unused internal futex functionsAdhemerval Zanella2020-11-251-2/+1
| | | | | | | | | | The __futex_abstimed_wait usage was remove with 3102e28bd11 and the __futex_abstimed_wait_cancelable by 323592fdc92 and b8d3e8fbaac. The futex_lock_pi can be replaced by a futex_lock_pi64. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Add {,sysdep-}ld-library-path make variableSamuel Thibault2020-11-161-1/+1
| | | | | | | | On GNU/Hurd we not only need $(common-objpfx) in LD_LIBRARY_PATH when loading dynamic objects, but also $(common-objpfx)/mach and $(common-objpfx)/hurd. This adds an ld-library-path variable to be used as LD_LIBRARY_PATH basis in Makefiles, and a sysdep-ld-library-path variable for sysdeps to add some more paths, here mach/ and hurd/.
* nptl: Move stack list variables into _rtld_globalFlorian Weimer2020-11-165-126/+47
| | | | | | | | | Now __thread_gscope_wait (the function behind THREAD_GSCOPE_WAIT, formerly __wait_lookup_done) can be implemented directly in ld.so, eliminating the unprotected GL (dl_wait_lookup_done) function pointer. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Eliminate <smp.h> and __is_smpFlorian Weimer2020-11-136-43/+0
| | | | | | | | | | | Most systems are SMP, so optimizing for the UP case is no longer approriate. A dynamic check based on the kernel identification has been only implemented for i386 anyway. To disable adaptive mutexes on sh, define DEFAULT_ADAPTIVE_COUNT as zero for this architecture. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst-setuid1-static-ENV: Add $(common-objpfx)nss [BZ #26820]H.J. Lu2020-11-031-1/+1
| | | | | | | | | | | | | | | | | | commit def674652eeac60c386d04733318b311f8a5b620 Author: Florian Weimer <fweimer@redhat.com> Date: Mon Apr 27 15:00:14 2020 +0200 nptl/tst-setuid1-static: Improve isolation from system objects Static dlopen needs an LD_LIBRARY_PATH setting to avoid loading system libraries. missed $(common-objpfx)nss. Add $(common-objpfx)nss to LD_LIBRARY_PATH for tst-setuid1-static to support struct passwd *pwd = getpwnam ("nobody"); in nptl/tst-setuid1.c.
* Disable spurious -Wstringop-overflow for setjmp/longjmp (bug 26647)Joseph Myers2020-10-302-0/+20
| | | | | | | | | | | | | | | | | Building glibc with GCC 11 fails with (among other warnings) spurious -Wstringop-overflow warnings from calls to setjmp and longjmp with a pointer to a pthread_unwind_buf that is smaller than jmp_buf. As discussed in bug 26647, the warning in libc-start.c is a false positive, because setjmp and longjmp do not access anything (the signal mask) beyond the common prefix of the two structures, so this patch disables the warning for that call to setjmp, as well as for two calls in NPTL code that produce the same warning and look like false positives for the same reason. Tested with build-many-glibcs.py for arm-linux-gnueabi, where this allows the build to get further. Reviewed-by: DJ Delorie <dj@redhat.com>
* y2038: nptl: Provide __futex_clock_wait_bitset64 to support 64 bit bitsetLukasz Majewski2020-10-211-1/+1
| | | | | | | | | | | | | | | The commit: "y2038: nptl: Convert pthread_mutex_{clock|timed}lock to support 64 bit" SHA1: 29e9874a048f47e2d46c40253036c8d2de921548 introduced support for 64 bit timeouts. Unfortunately, it was missing the code for bitset - i.e. lll_futex_clock_wait_bitset C preprocessor macro was used. As a result the 64 bit struct __timespec64 was coerced to 32 bit struct timespec and regression visible as timeout was observed (nptl/tst-robust10 on s390). Reported-by: Stefan Liebler <stli@linux.ibm.com> Tested-by: Stefan Liebler <stli@linux.ibm.com>
* y2038: nptl: Convert pthread_mutex_{clock|timed}lock to support 64 bitLukasz Majewski2020-10-152-20/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pthread_mutex_clocklock and pthread_mutex_timedlock have been converted to support 64 bit time. This change uses: - New __futex_clocklock_wait64 (instead of lll_timedwait) from ./sysdeps/nptl/futex-helpers.c and - New __futex_clocklock64 function (instead of lll_clocklock) - New futex_lock_pi64 defined in sysdeps/nptl/futex-internal.h The pthread_mutex_{clock|timed}lock only accepts absolute time. Moreover, there is no need to check for NULL passed as *abstime pointer to the syscalls as those calls have exported symbols marked with __nonull attribute for abstime. Some architectures - namely x86, powerpc and s390 - do support lock elision. For those - adjustments have been made in arch specific elision-*.c files to use __futex_clocklock64 instead of lll_clocklock. The __lll_lock_elision (aliased to __lll_clocklock_elision in e.g. sysdeps/unix/sysv/linux/s390/elision-timed.c) just uses, in this patch provided, __futex_clocklock64. For systems with __TIMESIZE != 64 && __WORDSIZE == 32: - Conversions between 64 bit time to 32 bit are necessary - Redirection to pthread_mutex_{clock|timed}lock will provide support for 64 bit time Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Revert "Fix missing redirects in testsuite targets"Andreas Schwab2020-10-081-1/+1
| | | | | This reverts commit d5afb38503. The log files are actually created by the various shell scripts that drive the tests.
* y2038: nptl: Convert pthread_rwlock_{clock|timed}{rd|wr}lock to support 64 ↵Lukasz Majewski2020-10-048-31/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bit time The pthread_rwlock_clockrdlock, pthread_rwlock_clockwrlock, pthread_rwlock_timedrdlock and pthread_rwlock_timedwrlock have been converted to support 64 bit time. This change uses new futex_abstimed_wait64 function in ./sysdeps/nptl/futex-helpers.c, which uses futex_time64 where possible. The pthread_rwlock_{clock|timed}{rd|wr}lock only accepts absolute time. Moreover, there is no need to check for NULL passed as *abstime pointer to the syscalls as those calls have exported symbols marked with __nonull attribute for abstime. For systems with __TIMESIZE != 64 && __WORDSIZE == 32: - Conversions between 64 bit time to 32 bit are necessary - Redirection to pthread_rwlock_{clock|timed}{rd|wr}lock will provide support for 64 bit time Build tests: ./src/scripts/build-many-glibcs.py glibcs Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master Above tests were performed with Y2038 redirection applied as well as without to test the proper usage of both __pthread_rwlock_{clock|timed}{rd|wr}lock64 and __pthread_rwlock_{clock|timed}{rd|wr}lock. Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* aarch64: enforce >=64K guard size [BZ #26691]Szabolcs Nagy2020-10-021-2/+12
| | | | | | | | | | | | | | | | | | | | | | | There are several compiler implementations that allow large stack allocations to jump over the guard page at the end of the stack and corrupt memory beyond that. See CVE-2017-1000364. Compilers can emit code to probe the stack such that the guard page cannot be skipped, but on aarch64 the probe interval is 64K by default instead of the minimum supported page size (4K). This patch enforces at least 64K guard on aarch64 unless the guard is disabled by setting its size to 0. For backward compatibility reasons the increased guard is not reported, so it is only observable by exhausting the address space or parsing /proc/self/maps on linux. On other targets the patch has no effect. If the stack probe interval is larger than a page size on a target then ARCH_MIN_GUARD_SIZE can be defined to get large enough stack guard on libc allocated stacks. The patch does not affect threads with user allocated stacks. Fixes bug 26691.
* y2038: nptl: Convert sem_{clock|timed}wait to support 64 bit timeLukasz Majewski2020-09-145-14/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The sem_clockwait and sem_timedwait have been converted to support 64 bit time. This change reuses futex_abstimed_wait_cancelable64 function introduced earlier. The sem_{clock|timed}wait only accepts absolute time. Moreover, there is no need to check for NULL passed as *abstime pointer to the syscalls as both calls have exported symbols marked with __nonull attribute for abstime. For systems with __TIMESIZE != 64 && __WORDSIZE == 32: - Conversion from 32 bit time to 64 bit struct __timespec64 was necessary - Redirection to __sem_{clock|timed}wait64 will provide support for 64 bit time Build tests: ./src/scripts/build-many-glibcs.py glibcs Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master Above tests were performed with Y2038 redirection applied as well as without to test the proper usage of both __sem_{clock|timed}wait64 and __sem_{clock|timed}wait. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove internal usage of extensible stat functionsAdhemerval Zanella2020-09-111-1/+1
| | | | | | | | | | | | It replaces the internal usage of __{f,l}xstat{at}{64} with the __{f,l}stat{at}{64}. It should not change the generate code since sys/stat.h explicit defines redirections to internal calls back to xstat* symbols. Checked with a build for all affected ABIs. I also check on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* y2038: nptl: Convert pthread_cond_{clock|timed}wait to support 64 bit timeLukasz Majewski2020-09-022-8/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pthread_cond_clockwait and pthread_cond_timedwait have been converted to support 64 bit time. This change introduces new futex_abstimed_wait_cancelable64 function in ./sysdeps/nptl/futex-helpers.c, which uses futex_time64 where possible and tries to replace low-level preprocessor macros from lowlevellock-futex.h The pthread_cond_{clock|timed}wait only accepts absolute time. Moreover, there is no need to check for NULL passed as *abstime pointer as __pthread_cond_wait_common() always passes non-NULL struct __timespec64 pointer to futex_abstimed_wait_cancellable64(). For systems with __TIMESIZE != 64 && __WORDSIZE == 32: - Conversions between 64 bit time to 32 bit are necessary - Redirection to __pthread_cond_{clock|timed}wait64 will provide support for 64 bit time The futex_abstimed_wait_cancelable64 function has been put into a separate file on the purpose - to avoid issues apparent on the m68k architecture related to small number of available registers (there is not enough registers to put all necessary arguments in them if the above function would be added to futex-internal.h with __always_inline attribute). In fact - new function - namely __futex_abstimed_wait_cancellable32 is used to reduce number of needed registers (as some in-register values are stored on the stack when function call is made). Build tests: ./src/scripts/build-many-glibcs.py glibcs Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master Above tests were performed with Y2038 redirection applied as well as without to test the proper usage of both __pthread_cond_{clock|timed}wait64 and __pthread_cond_{clock|timed}wait. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl: Handle NULL abstime [BZ #26394]H.J. Lu2020-08-172-6/+16
| | | | | Since abstime passed to pthread_{clock|timed}join_np may be NULL, convert to 64 bit abstime only if abstime isn't NULL.
* y2038: nptl: Convert pthread_{clock|timed}join_np to support 64 bit timeLukasz Majewski2020-08-134-14/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pthread_clockjoin_np and pthread_timedjoin_np have been converted to support 64 bit time. This change introduces new futex_timed_wait_cancel64 function in ./sysdeps/nptl/futex-internal.h, which uses futex_time64 where possible and tries to replace low-level preprocessor macros from lowlevellock-futex.h The pthread_{timed|clock}join_np only accept absolute time. Moreover, there is no need to check for NULL passed as *abstime pointer as clockwait_tid() always passes struct __timespec64. For systems with __TIMESIZE != 64 && __WORDSIZE == 32: - Conversions between 64 bit time to 32 bit are necessary - Redirection to __pthread_{clock|timed}join_np64 will provide support for 64 bit time Build tests: ./src/scripts/build-many-glibcs.py glibcs Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master Above tests were performed with Y2038 redirection applied as well as without to test the proper usage of both __pthread_{timed|clock}join_np64 and __pthread_{timed|clock}join_np. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* htl: Enable tst-cancelx?[45]Samuel Thibault2020-08-067-1991/+2
| | | | | | | * nptl/{tst-cancel4-common.c, tst-cancel4-common.h, tst-cancel4.c, tst-cancel5.c, tst-cancelx4.c, tst-cancelx5.c}: Move to sysdeps/pthread/ * nptl/Makefile: Move corresponding rules to... * sysdeps/pthread/Makefile: ... here.
* tst-cancel4: Make blocking on write more portableSamuel Thibault2020-08-071-4/+4
| | | | | * nptl/tst-cancel4.c (tf_send, tf_sendto): Set socket buffer size after connecting.
* nptl: Zero-extend arguments to SETXID syscalls [BZ #26248]H.J. Lu2020-07-273-2/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nptl has /* Opcodes and data types for communication with the signal handler to change user/group IDs. */ struct xid_command { int syscall_no; long int id[3]; volatile int cntr; volatile int error; }; /* This must be last, otherwise the current thread might not have permissions to send SIGSETXID syscall to the other threads. */ result = INTERNAL_SYSCALL_NCS (cmdp->syscall_no, 3, cmdp->id[0], cmdp->id[1], cmdp->id[2]); But the second argument of setgroups syscal is a pointer: int setgroups (size_t size, const gid_t *list); But on x32, pointers passed to syscall must have pointer type so that they will be zero-extended. The kernel XID arguments are unsigned and do not require sign extension. Change xid_command to struct xid_command { int syscall_no; unsigned long int id[3]; volatile int cntr; volatile int error; }; so that all arguments are zero-extended. A testcase is added for x32 and setgroups returned with EFAULT when running as root without the fix.
* Linux: Remove rseq supportFlorian Weimer2020-07-161-13/+0
| | | | | | | | | | | | | | | | | | The kernel ABI is not finalized, and there are now various proposals to change the size of struct rseq, which would make the glibc ABI dependent on the version of the kernels used for building glibc. This is of course not acceptable. This reverts commit 48699da1c468543ade14777819bd1b4d652709de ("elf: Support at least 32-byte alignment in static dlopen"), commit 8f4632deb3545b2949cec5454afc3cb21a0024ea ("Linux: rseq registration tests"), commit 6e29cb3f61ff5432c78a1c84b0d9b123a350ab36 ("Linux: Use rseq in sched_getcpu if available"), and commit 0c76fc3c2b346dc5401dc055d97d4279632b0fb3 ("Linux: Perform rseq registration at C startup and thread creation"), resolving the conflicts introduced by the ARC port and the TLS static surplus changes. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* string: Remove old TLS usage on strsignalAdhemerval Zanella2020-07-072-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The per-thread state is refactored two use two strategies: 1. The default one uses a TLS structure, which will be placed in the static TLS space (using __thread keyword). 2. Linux allocates via struct pthread and access it through THREAD_* macros. The default strategy has the disadvantage of increasing libc.so static TLS consumption and thus decreasing the possible surplus used in some scenarios (which might be mitigated by BZ#25051 fix). It is used only on Hurd, where accessing the thread storage in the in single thread case is not straightforward (afaiu, Hurd developers could correct me here). The fallback static allocation used for allocation failure is also removed: defining its size is problematic without synchronizing with translated messages (to avoid partial translation) and the resulting usage is not thread-safe. Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, and s390x-linux-gnu. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Fix __NSIG_WORDS and add __NSIG_BYTESAdhemerval Zanella2020-07-072-2/+2
| | | | | | | | | | | | | | The __NSIG_WORDS value is based on minimum number of words to hold the maximum number of signals supported by the architecture. This patch also adds __NSIG_BYTES, which is the number of bytes required to represent the supported number of signals. It is used in syscalls which takes a sigset_t. Checked on x86_64-linux-gnu and i686-linux-gnu. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>