glibc/sysdeps
Stefan Liebler db988e50a8 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)
2018-05-10 10:56:25 +00: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 hurd: take __USE_EXTERN_INLINES into account and restrict inlines 2018-01-28 18:46:23 +01: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). 2018-03-28 22:19:41 +02:00
ia64 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ieee754 Fix ldbl-128ibm log1pl (-qNaN) spurious "invalid" exception (bug 22693). 2018-01-10 17:59:01 +00: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] 2018-05-10 10:56:25 +00: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-08 09:02:06 -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. 2018-03-19 19:38:28 +01: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:04:44 -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. 2018-05-10 10:56:25 +00: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 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
x86_64 Revert Intel CET changes to __jmp_buf_tag (Bug 22743) 2018-01-25 23:43:46 -08:00