linux-stable/arch/x86
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
..
boot x86/boot/compressed/64: Check SEV encryption in the 32-bit boot-path 2021-05-26 12:06:57 +02:00
configs
crypto crypto: poly1305 - fix poly1305_core_setkey() declaration 2021-05-14 09:50:13 +02:00
entry x86/entry: Fix noinstr fail in __do_fast_syscall_32() 2021-06-30 08:47:17 -04:00
events perf/x86: Track pmu in per-CPU cpu_hw_events 2021-06-30 08:47:24 -04:00
hyperv x86/hyperv: Fix kexec panic/hang issues 2021-01-27 11:54:57 +01:00
ia32
include Revert "KVM: x86/mmu: Drop kvm_mmu_extended_role.cr4_la57 hack" 2021-07-07 08:22:47 -04:00
kernel x86/fpu: Make init_fpstate correct with optimized XSAVE 2021-06-30 08:47:26 -04:00
kvm Revert "KVM: x86/mmu: Drop kvm_mmu_extended_role.cr4_la57 hack" 2021-07-07 08:22:47 -04:00
lib x86/msr: Fix wr/rdmsr_safe_regs_on_cpu() prototypes 2021-05-22 11:40:51 +02:00
math-emu
mm x86/ioremap: Map EFI-reserved memory as encrypted for SEV 2021-06-23 14:42:52 +02:00
net bpf, x86: Validate computation of branch displacements for x86-32 2021-04-10 13:36:11 +02:00
oprofile
pci PCI: Add AMD RS690 quirk to enable 64-bit DMA 2021-06-30 08:47:23 -04:00
platform x86/efi: Remove EFI PGD build time checks 2021-02-17 11:02:24 +01:00
power PM: hibernate: x86: Use crc32 instead of md5 for hibernation e820 integrity check 2021-05-14 09:50:21 +02:00
purgatory treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
ras
realmode
tools x86/build: Treat R_386_PLT32 relocation as R_386_PC32 2021-03-07 12:34:04 +01:00
um arch/um: partially revert the conversion to __section() macro 2020-10-26 15:39:37 -07:00
video
xen x86/xen: Fix noinstr fail in exc_xen_unknown_trap() 2021-06-30 08:47:18 -04:00
.gitignore
Kbuild
Kconfig x86/platform/uv: Fix !KEXEC build failure 2021-05-14 09:50:20 +02:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
Makefile x86/build: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS) 2021-05-11 14:47:18 +02:00
Makefile.um
Makefile_32.cpu