exynos-linux-stable/arch/x86/kernel/cpu
Sean Christopherson 8305780a3e x86/pkeys: Manually set X86_FEATURE_OSPKE to preserve existing changes
commit 735a6dd02222d8d070c7bb748f25895239ca8c92 upstream.

Explicitly set X86_FEATURE_OSPKE via set_cpu_cap() instead of calling
get_cpu_cap() to pull the feature bit from CPUID after enabling CR4.PKE.
Invoking get_cpu_cap() effectively wipes out any {set,clear}_cpu_cap()
changes that were made between this_cpu->c_init() and setup_pku(), as
all non-synthetic feature words are reinitialized from the CPU's CPUID
values.

Blasting away capability updates manifests most visibility when running
on a VMX capable CPU, but with VMX disabled by BIOS.  To indicate that
VMX is disabled, init_ia32_feat_ctl() clears X86_FEATURE_VMX, using
clear_cpu_cap() instead of setup_clear_cpu_cap() so that KVM can report
which CPU is misconfigured (KVM needs to probe every CPU anyways).
Restoring X86_FEATURE_VMX from CPUID causes KVM to think VMX is enabled,
ultimately leading to an unexpected #GP when KVM attempts to do VMXON.

Arguably, init_ia32_feat_ctl() should use setup_clear_cpu_cap() and let
KVM figure out a different way to report the misconfigured CPU, but VMX
is not the only feature bit that is affected, i.e. there is precedent
that tweaking feature bits via {set,clear}_cpu_cap() after ->c_init()
is expected to work.  Most notably, x86_init_rdrand()'s clearing of
X86_FEATURE_RDRAND when RDRAND malfunctions is also overwritten.

Fixes: 0697694564 ("x86/mm/pkeys: Actually enable Memory Protection Keys in the CPU")
Reported-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Tested-by: Jacob Keller <jacob.e.keller@intel.com>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20200226231615.13664-1-sean.j.christopherson@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-11 07:53:12 +01:00
..
mcheck x86/mce/amd: Fix kobject lifetime 2020-02-28 15:42:48 +01:00
microcode x86/microcode: Update the new microcode revision unconditionally 2019-05-14 19:19:33 +02:00
mtrr x86/mtrr: Don't copy uninitialized gentry fields back to userspace 2018-12-29 13:40:15 +01:00
.gitignore
amd.c x86/CPU/AMD: Clear RDRAND CPUID bit on AMD family 15h/16h 2019-09-06 10:19:41 +02:00
bugs.c x86/speculation: Fix redundant MDS mitigation message 2019-11-28 18:29:03 +01:00
centaur.c x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:43:55 +01:00
common.c x86/pkeys: Manually set X86_FEATURE_OSPKE to preserve existing changes 2020-03-11 07:53:12 +01:00
cpu.h x86/cpu: Add a "tsx=" cmdline option with TSX disabled by default 2019-11-16 10:29:41 +01:00
cyrix.c x86/CPU: Use correct macros for Cyrix calls 2019-11-25 09:52:46 +01:00
hypervisor.c virt, sched: Add generic vCPU pinning support 2016-09-05 13:52:38 +02:00
intel.c x86/cpu: Add a "tsx=" cmdline option with TSX disabled by default 2019-11-16 10:29:41 +01:00
intel_cacheinfo.c drivers: base: cacheinfo: fix x86 with CONFIG_OF enabled 2018-01-31 12:55:51 +01:00
Makefile x86/cpu: Add a "tsx=" cmdline option with TSX disabled by default 2019-11-16 10:29:41 +01:00
match.c x86/kernel: Audit and remove any unnecessary uses of module.h 2016-07-14 15:06:41 +02:00
mkcapflags.sh x86/build: Add 'set -e' to mkcapflags.sh to delete broken capflags.c 2019-08-04 09:33:22 +02:00
mshyperv.c x86/hyperv: Handle unknown NMIs on one CPU when unknown_nmi_panic 2017-03-22 12:43:36 +01:00
perfctr-watchdog.c x86/kernel: Audit and remove any unnecessary uses of module.h 2016-07-14 15:06:41 +02:00
powerflags.c x86/cpu: Add advanced power management bits 2016-03-29 11:12:11 +02:00
proc.c x86/cpu: Change type of x86_cache_size variable to unsigned int 2018-02-22 15:43:55 +01:00
rdrand.c x86, asm: Use CC_SET()/CC_OUT() and static_cpu_has() in archrandom.h 2016-06-08 12:41:20 -07:00
scattered.c x86/cpufeatures: Add CPUID_7_EDX CPUID leaf 2018-02-13 12:35:58 +01:00
topology.c x86/cpu/topology: Provide detect_extended_topology_early() 2018-08-15 18:14:46 +02:00
transmeta.c Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-03-15 09:32:27 -07:00
tsx.c x86/cpu: Update cached HLE state on write to TSX_CTRL_CPUID_CLEAR 2020-02-14 16:30:58 -05:00
umc.c
vmware.c x86/vmware: Skip timer_irq_works() check on VMware 2016-10-19 17:36:33 +02:00