linux-stable/arch/x86/kvm
Sean Christopherson 4dc9680428 Revert "KVM: x86/mmu: Drop kvm_mmu_extended_role.cr4_la57 hack"
commit f71a53d118 upstream.

Restore CR4.LA57 to the mmu_role to fix an amusing edge case with nested
virtualization.  When KVM (L0) is using TDP, CR4.LA57 is not reflected in
mmu_role.base.level because that tracks the shadow root level, i.e. TDP
level.  Normally, this is not an issue because LA57 can't be toggled
while long mode is active, i.e. the guest has to first disable paging,
then toggle LA57, then re-enable paging, thus ensuring an MMU
reinitialization.

But if L1 is crafty, it can load a new CR4 on VM-Exit and toggle LA57
without having to bounce through an unpaged section.  L1 can also load a
new CR3 on exit, i.e. it doesn't even need to play crazy paging games, a
single entry PML5 is sufficient.  Such shenanigans are only problematic
if L0 and L1 use TDP, otherwise L1 and L2 share an MMU that gets
reinitialized on nested VM-Enter/VM-Exit due to mmu_role.base.guest_mode.

Note, in the L2 case with nested TDP, even though L1 can switch between
L2s with different LA57 settings, thus bypassing the paging requirement,
in that case KVM's nested_mmu will track LA57 in base.level.

This reverts commit 8053f924ca.

Fixes: 8053f924ca ("KVM: x86/mmu: Drop kvm_mmu_extended_role.cr4_la57 hack")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210622175739.3610207-6-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-07 08:22:47 -04:00
..
mmu Revert "KVM: x86/mmu: Drop kvm_mmu_extended_role.cr4_la57 hack" 2021-07-07 08:22:47 -04:00
svm KVM: SVM: Call SEV Guest Decommission if ASID binding fails 2021-06-30 08:47:29 -04:00
vmx KVM: x86: Defer vtime accounting 'til after IRQ handling 2021-05-28 13:17:43 +02:00
cpuid.c KVM: x86: Emulate RDPID only if RDTSCP is supported 2021-05-19 10:13:16 +02:00
cpuid.h KVM: x86: reinstate vendor-agnostic check on SPEC_CTRL cpuid bits 2020-12-30 11:54:14 +01:00
debugfs.c KVM: let kvm_destroy_vm_debugfs clean up vCPU debugfs directories 2020-06-04 11:00:54 -04:00
emulate.c KVM: x86: Move RDPID emulation intercept to its own enum 2021-05-19 10:13:16 +02:00
hyperv.c ARM: 2020-10-23 11:17:56 -07:00
hyperv.h x86/kvm/hyper-v: Add support for synthetic debugger interface 2020-06-01 04:26:11 -04:00
i8254.c kvm: i8254: remove redundant assignment to pointer s 2020-06-11 12:35:18 -04:00
i8254.h
i8259.c KVM: x86: Refactor picdev_write() to prevent Spectre-v1/L1TF attacks 2020-01-27 19:59:37 +01:00
ioapic.c KVM: ioapic: break infinite recursion on lazy EOI 2020-10-24 04:42:06 -04:00
ioapic.h kvm/x86: Remove redundant function implementations 2020-05-27 13:11:10 -04:00
irq.c KVM: x86: Fix split-irqchip vs interrupt injection window request 2020-11-27 09:27:28 -05:00
irq.h kvm/x86: Remove redundant function implementations 2020-05-27 13:11:10 -04:00
irq_comm.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
Kconfig x86/kvm: hide KVM options from menuconfig when KVM is not compiled 2020-10-21 17:36:30 -04:00
kvm_cache_regs.h KVM: x86: Let the guest own CR4.FSGSBASE 2020-10-21 17:48:50 -04:00
kvm_emulate.h KVM: x86: Move RDPID emulation intercept to its own enum 2021-05-19 10:13:16 +02:00
lapic.c kvm: LAPIC: Restore guard to prevent illegal APIC register access 2021-06-23 14:42:41 +02:00
lapic.h KVM: nVMX: Morph notification vector IRQ on nested VM-Enter to pending PI 2020-09-28 07:57:22 -04:00
Makefile kvm: x86/mmu: Init / Uninit the TDP MMU 2020-10-21 18:17:00 -04:00
mmu.h KVM: x86: fix shift out of bounds reported by UBSAN 2021-01-12 20:18:26 +01:00
mtrr.c KVM: x86: Protect MSR-based index computations in fixed_msr_to_seg_unit() from Spectre-v1/L1TF attacks 2020-01-27 19:59:39 +01:00
pmu.c KVM/x86: pmu: Fix #GP condition check for RDPMC emulation 2020-07-09 07:08:37 -04:00
pmu.h kvm: x86: limit the maximum number of vPMU fixed counters to 3 2020-07-08 16:21:59 -04:00
trace.h KVM: x86: Ensure liveliness of nested VM-Enter fail tracepoint message 2021-06-16 12:01:46 +02:00
tss.h
x86.c KVM: X86: Fix x86_emulator slab cache leak 2021-06-23 14:42:51 +02:00
x86.h KVM: x86: Supplement __cr4_reserved_bits() with X86_FEATURE_PCID check 2021-03-11 14:17:26 +01:00