linux_dsm_epyc7002/arch/x86
Thomas Gleixner f10ee3dcc9 x86/pti: Fix !PCID and sanitize defines
The switch to the user space page tables in the low level ASM code sets
unconditionally bit 12 and bit 11 of CR3. Bit 12 is switching the base
address of the page directory to the user part, bit 11 is switching the
PCID to the PCID associated with the user page tables.

This fails on a machine which lacks PCID support because bit 11 is set in
CR3. Bit 11 is reserved when PCID is inactive.

While the Intel SDM claims that the reserved bits are ignored when PCID is
disabled, the AMD APM states that they should be cleared.

This went unnoticed as the AMD APM was not checked when the code was
developed and reviewed and test systems with Intel CPUs never failed to
boot. The report is against a Centos 6 host where the guest fails to boot,
so it's not yet clear whether this is a virt issue or can happen on real
hardware too, but thats irrelevant as the AMD APM clearly ask for clearing
the reserved bits.

Make sure that on non PCID machines bit 11 is not set by the page table
switching code.

Andy suggested to rename the related bits and masks so they are clearly
describing what they should be used for, which is done as well for clarity.

That split could have been done with alternatives but the macro hell is
horrible and ugly. This can be done on top if someone cares to remove the
extra orq. For now it's a straight forward fix.

Fixes: 6fd166aae7 ("x86/mm: Use/Fix PCID to optimize user/kernel switches")
Reported-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable <stable@vger.kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Willy Tarreau <w@1wt.eu>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1801140009150.2371@nanos
2018-01-14 10:45:53 +01:00
..
boot x86/mm/pti: Add infrastructure for page table isolation 2017-12-23 21:12:59 +01:00
configs
crypto x86/retpoline/crypto: Convert crypto assembler indirect jumps 2018-01-12 00:14:29 +01:00
entry x86/pti: Fix !PCID and sanitize defines 2018-01-14 10:45:53 +01:00
events x86/events/intel/ds: Use the proper cache flush method for mapping ds buffers 2018-01-05 00:39:58 +01:00
hyperv
ia32
include x86/pti: Fix !PCID and sanitize defines 2018-01-14 10:45:53 +01:00
kernel x86/retpoline/irq32: Convert assembler indirect jumps 2018-01-12 00:14:32 +01:00
kvm x86/retpoline: Fill return stack buffer on vmexit 2018-01-12 12:33:37 +01:00
lib x86/retpoline/checksum32: Convert assembler indirect jumps 2018-01-12 00:14:31 +01:00
math-emu
mm x86/mm/pti: Remove dead logic in pti_user_pagetable_walk*() 2018-01-08 17:42:13 +01:00
net
oprofile
pci
platform x86/pti: Unbreak EFI old_memmap 2018-01-06 21:38:16 +01:00
power x86/entry: Remap the TSS into the CPU entry area 2017-12-17 13:59:56 +01:00
purgatory
ras
realmode
tools
um
video
xen x86/cpu_entry_area: Move it out of the fixmap 2017-12-22 20:13:05 +01:00
.gitignore
Kbuild
Kconfig x86/retpoline: Add initial retpoline support 2018-01-12 00:14:28 +01:00
Kconfig.cpu
Kconfig.debug
Makefile x86/retpoline: Add initial retpoline support 2018-01-12 00:14:28 +01:00
Makefile_32.cpu
Makefile.um