glibc/sysdeps
Adhemerval Zanella 1e52d8e65a i386: Fix i386 sigaction sa_restorer initialization (BZ#21269)
This patch fixes the i386 sa_restorer field initialization for sigaction
syscall for kernel with vDSO.  As described in bug report, i386 Linux
(and compat on x86_64) interprets SA_RESTORER clear with nonzero
sa_restorer as a request for stack switching if the SS segment is 'funny'.
This means that anything that tries to mix glibc's signal handling with
segmentation (for instance through modify_ldt syscall) is randomly broken
depending on what values lands in sa_restorer.

The testcase added  is based on Linux test tools/testing/selftests/x86/ldt_gdt.c,
more specifically in do_multicpu_tests function.  The main changes are:

  - C11 atomics instead of plain access.

  - Remove x86_64 support which simplifies the syscall handling and fallbacks.

  - Replicate only the test required to trigger the issue.

Checked on i686-linux-gnu.

	[BZ #21269]
	* sysdeps/unix/sysv/linux/i386/Makefile (tests): Add tst-bz21269.
	* sysdeps/unix/sysv/linux/i386/sigaction.c (SET_SA_RESTORER): Clear
	sa_restorer for vDSO case.
	* sysdeps/unix/sysv/linux/i386/tst-bz21269.c: New file.

(cherry picked from commit 68448be208)
2018-03-12 19:26:40 +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 Revert Intel CET changes to __jmp_buf_tag (Bug 22743) 2018-01-25 23:43:46 -08: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 Revert Intel CET changes to __jmp_buf_tag (Bug 22743) 2018-01-25 23:43:46 -08: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: Build Infastructure 2018-01-29 10:43:15 -08: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 i386: Fix i386 sigaction sa_restorer initialization (BZ#21269) 2018-03-12 19:26:40 +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