linux/arch/x86
Maxim Levitsky 94cc0809e5 KVM: nVMX: don't use vcpu->arch.efer when checking host state on nested state load
commit af957eebfc upstream.

When loading nested state, don't use check vcpu->arch.efer to get the
L1 host's 64-bit vs. 32-bit state and don't check it for consistency
with respect to VM_EXIT_HOST_ADDR_SPACE_SIZE, as register state in vCPU
may be stale when KVM_SET_NESTED_STATE is called---and architecturally
does not exist.  When restoring L2 state in KVM, the CPU is placed in
non-root where nested VMX code has no snapshot of L1 host state: VMX
(conditionally) loads host state fields loaded on VM-exit, but they need
not correspond to the state before entry.  A simple case occurs in KVM
itself, where the host RIP field points to vmx_vmexit rather than the
instruction following vmlaunch/vmresume.

However, for the particular case of L1 being in 32- or 64-bit mode
on entry, the exit controls can be treated instead as the source of
truth regarding the state of L1 on entry, and can be used to check
that vmcs12.VM_EXIT_HOST_ADDR_SPACE_SIZE matches vmcs12.HOST_EFER if
vmcs12.VM_EXIT_LOAD_IA32_EFER is set.  The consistency check on CPU
EFER vs. vmcs12.VM_EXIT_HOST_ADDR_SPACE_SIZE, instead, happens only
on VM-Enter.  That's because, again, there's conceptually no "current"
L1 EFER to check on KVM_SET_NESTED_STATE.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20211115131837.195527-2-mlevitsk@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-25 09:48:45 +01:00
..
boot Kbuild updates for v5.15 2021-09-03 15:33:47 -07:00
configs configs: remove the obsolete CONFIG_INPUT_POLLDEV 2021-09-08 11:50:28 -07:00
crypto crypto: aesni - check walk.nbytes instead of err 2021-11-18 19:16:10 +01:00
entry compat: remove some compat entry points 2021-09-08 15:32:35 -07:00
events perf/x86/intel/uncore: Fix IIO event constraints for Snowridge 2021-11-25 09:48:41 +01:00
hyperv x86/hyperv: Fix NULL deref in set_hv_tscchange_cb() if Hyper-V setup fails 2021-11-25 09:48:43 +01:00
ia32 binfmt: remove in-tree usage of MAP_DENYWRITE 2021-09-03 18:42:01 +02:00
include KVM: x86/mmu: include EFER.LMA in extended mmu role 2021-11-25 09:48:43 +01:00
kernel x86/sgx: Fix free page accounting 2021-11-25 09:48:43 +01:00
kvm KVM: nVMX: don't use vcpu->arch.efer when checking host state on nested state load 2021-11-25 09:48:45 +01:00
lib x86/insn: Use get_unaligned() instead of memcpy() 2021-11-18 19:16:30 +01:00
math-emu x86/math-emu: Rename frstor() 2021-06-23 18:16:33 +02:00
mm x86/sev: Make the #VC exception stacks part of the default stacks storage 2021-11-18 19:17:21 +01:00
net bpf, x86: Fix bpf mapping of atomic fetch implementation 2021-09-28 12:10:29 +02:00
pci xen: branch for v5.15-rc5 2021-10-08 12:55:23 -07:00
platform - A FPU fix to properly handle invalid MXCSR values: 32-bit masks them 2021-10-10 10:00:51 -07:00
power x86/power: Fix kernel-doc warnings in cpu.c 2021-08-12 10:15:40 +02:00
purgatory kernel.h: split out panic and oops helpers 2021-07-01 11:06:04 -07:00
ras
realmode memblock: make memblock_find_in_range method private 2021-09-03 09:58:17 -07:00
tools - Remove cc-option checks which are old and already supported by the 2021-08-30 13:27:16 -07:00
um um: fix stub location calculation 2021-08-26 22:28:03 +02:00
video
xen xen/x86: adjust data placement 2021-10-05 08:36:19 +02:00
.gitignore
Kbuild
Kconfig x86/sev: Add an x86 version of cc_platform_has() 2021-11-18 19:17:21 +01:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug tracing: Refactor TRACE_IRQFLAGS_SUPPORT in Kconfig 2021-08-16 11:37:21 -04:00
Makefile Kbuild updates for v5.15 2021-09-03 15:33:47 -07:00
Makefile.um um: allow not setting extra rpaths in the linux binary 2021-06-17 21:54:15 +02:00
Makefile_32.cpu x86/build: Do not add -falign flags unconditionally for clang 2021-09-19 10:35:53 +09:00