glibc/sysdeps
Stefan Liebler b3356fb4a1 Fix blocking pthread_join. [BZ #23137]
On s390 (31bit) if glibc is build with -Os, pthread_join sometimes
blocks indefinitely. This is e.g. observable with
testcase intl/tst-gettext6.

pthread_join is calling lll_wait_tid(tid), which performs the futex-wait
syscall in a loop as long as tid != 0 (thread is alive).

On s390 (and build with -Os), tid is loaded from memory before
comparing against zero and then the tid is loaded a second time
in order to pass it to the futex-wait-syscall.
If the thread exits in between, then the futex-wait-syscall is
called with the value zero and it waits until a futex-wake occurs.
As the thread is already exited, there won't be a futex-wake.

In lll_wait_tid, the tid is stored to the local variable __tid,
which is then used as argument for the futex-wait-syscall.
But unfortunately the compiler is allowed to reload the value
from memory.

With this patch, the tid is loaded with atomic_load_acquire.
Then the compiler is not allowed to reload the value for __tid from memory.

ChangeLog:

	[BZ #23137]
	* sysdeps/nptl/lowlevellock.h (lll_wait_tid):
	Use atomic_load_acquire to load __tid.

(cherry picked from commit 1660901840)
2021-08-27 16:22:12 -07:00
..
aarch64 aarch64: fix static pie enabled libc when main is in a shared library 2018-01-12 18:10:03 +00:00
alpha Update Alpha libm-test-ulps 2018-01-27 13:31:38 +01:00
arm Update ARM libm-test-ulps. 2018-01-02 18:37:06 +00:00
generic For Google b/8315591, experimental implementation of dlopen_with_offset. 2014-03-10 14:02:07 -07:00
gnu LIBC_SLIBDIR_RTLDDIR: substitute arguments in single quotes 2018-01-25 17:20:28 +01:00
hppa Update hppa libm-test-ulps 2018-01-27 13:32:36 +01:00
i386 Fix i386 memmove issue (bug 22644). 2021-08-27 16:22:08 -07:00
ia64 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ieee754 Add workarounds for incomplete float128 support in clang 2018-01-23 09:41:49 -08:00
init_array sysdeps/init_array: Add PREINIT_FUNCTION to crti.S 2018-01-29 10:22:26 -08:00
m68k Add no-FPU ColdFire math_private.h. 2018-01-24 23:33:03 +00:00
mach hurd: include generic's hp-timing.h instead of copying it 2018-01-30 01:17:51 +01:00
microblaze Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mips Update MIPS libm-test-ulps. 2018-01-02 21:55:15 +00:00
nios2 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
nptl Fix blocking pthread_join. [BZ #23137] 2021-08-27 16:22:12 -07:00
posix Reject invalid definitions of _POSIX_CHOWN_RESTRICTED, _POSIX_NO_TRUNC, _POSIX_VDISABLE 2018-01-29 22:21:21 +01:00
powerpc powerpc: Fix TLE build for SPE (BZ #22926) 2018-03-05 14:46:24 -03:00
pthread allocalim.h: use __glibc_likely instead of __builtin_expect 2018-01-30 21:42:21 +01:00
riscv RISC-V: fmax/fmin: Handle signalling NaNs correctly. 2021-08-27 16:22:07 -07:00
s390 Fix s390 linknamespace fallout of bug 22702 patch. 2018-01-12 00:12:57 +00:00
sh Update SH libm-tests-ulps 2018-02-14 14:03:13 -02:00
sparc sparc: Check PIC instead of SHARED in start.S [BZ #22638] 2018-02-06 09:31:30 +00:00
tile Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
unix Add PTRACE_SECCOMP_GET_METADATA from Linux 4.16 to sys/ptrace.h. 2021-08-27 16:22:11 -07:00
wordsize-32 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wordsize-64 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
x86 Comment out debugging hack that pollutes namespace 2018-01-24 11:32:36 -08:00
x86_64 Skip a test that lld cannot handle 2018-02-27 11:17:27 -08:00