linux/arch/x86/entry/vdso
Andy Lutomirski ff17bbe0bb x86/vdso: Prevent segfaults due to hoisted vclock reads
GCC 5.5.0 sometimes cleverly hoists reads of the pvclock and/or hvclock
pages before the vclock mode checks.  This creates a path through
vclock_gettime() in which no vclock is enabled at all (due to disabled
TSC on old CPUs, for example) but the pvclock or hvclock page
nevertheless read.  This will segfault on bare metal.

This fixes commit 459e3a2153 ("gcc-9: properly declare the
{pv,hv}clock_page storage") in the sense that, before that commit, GCC
didn't seem to generate the offending code.  There was nothing wrong
with that commit per se, and -stable maintainers should backport this to
all supported kernels regardless of whether the offending commit was
present, since the same crash could just as easily be triggered by the
phase of the moon.

On GCC 9.1.1, this doesn't seem to affect the generated code at all, so
I'm not too concerned about performance regressions from this fix.

Cc: stable@vger.kernel.org
Cc: x86@kernel.org
Cc: Borislav Petkov <bp@alien8.de>
Reported-by: Duncan Roe <duncan_roe@optusnet.com.au>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-06-21 13:31:52 -07:00
..
vdso32 x86: Add build salt to the vDSO 2018-07-18 01:18:05 +09:00
.gitignore
checkundef.sh
Makefile x86/build/vdso: Add FORCE to the build rule of %.so 2019-04-18 10:05:34 +02:00
vclock_gettime.c x86/vdso: Prevent segfaults due to hoisted vclock reads 2019-06-21 13:31:52 -07:00
vdso2c.c x86/vdso: Remove hpet_page from vDSO 2019-05-08 13:13:57 +02:00
vdso2c.h x86/vdso: Rename variable to fix -Wshadow warning 2019-04-19 21:33:46 +02:00
vdso32-setup.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vdso-layout.lds.S x86/vdso: Remove a stale/misleading comment from the linker script 2018-12-05 08:58:12 +01:00
vdso-note.S x86: Add build salt to the vDSO 2018-07-18 01:18:05 +09:00
vdso.lds.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vdsox32.lds.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vgetcpu.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 223 2019-05-30 11:29:55 -07:00
vma.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 214 2019-05-30 11:29:54 -07:00