kernel_samsung_a53x/arch/x86/kvm
Sean Christopherson 5007c03ef5 KVM: nSVM: Ignore nCR3[4:0] when loading PDPTEs from memory
commit f559b2e9c5c5308850544ab59396b7d53cfc67bd upstream.

Ignore nCR3[4:0] when loading PDPTEs from memory for nested SVM, as bits
4:0 of CR3 are ignored when PAE paging is used, and thus VMRUN doesn't
enforce 32-byte alignment of nCR3.

In the absolute worst case scenario, failure to ignore bits 4:0 can result
in an out-of-bounds read, e.g. if the target page is at the end of a
memslot, and the VMM isn't using guard pages.

Per the APM:

  The CR3 register points to the base address of the page-directory-pointer
  table. The page-directory-pointer table is aligned on a 32-byte boundary,
  with the low 5 address bits 4:0 assumed to be 0.

And the SDM's much more explicit:

  4:0    Ignored

Note, KVM gets this right when loading PDPTRs, it's only the nSVM flow
that is broken.

Fixes: e4e517b4be01 ("KVM: MMU: Do not unconditionally read PDPTE from guest memory")
Reported-by: Kirk Swidowski <swidowski@google.com>
Cc: Andy Nguyen <theflow@google.com>
Cc: 3pvd <3pvd@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-ID: <20241009140838.1036226-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:22:01 +01:00
..
mmu KVM: use __vcalloc for very large allocations 2024-11-18 12:12:59 +01:00
svm KVM: nSVM: Ignore nCR3[4:0] when loading PDPTEs from memory 2024-11-23 23:22:01 +01:00
vmx KVM: VMX: Split out the non-virtualization part of vmx_interrupt_blocked() 2024-11-23 23:20:13 +01:00
cpuid.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cpuid.h x86/cpufeatures: Add CPUID_LNX_5 to track recently added Linux-defined word 2024-11-19 09:23:11 +01:00
debugfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
emulate.c x86: Share definition of __is_canonical_address() 2024-11-18 11:43:11 +01:00
hyperv.c KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space 2024-11-18 11:43:21 +01:00
hyperv.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
i8254.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
i8254.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
i8259.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ioapic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ioapic.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
irq.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
irq.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
irq_comm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kvm_cache_regs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kvm_emulate.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lapic.c KVM: x86: Mask LVTPC when handling a PMI 2024-11-08 11:26:08 +01:00
lapic.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mmu.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mtrr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pmu.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
trace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tss.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
x86.c KVM: x86: Clear "has_error_code", not "error_code", for RM exception injection 2024-11-19 12:26:38 +01:00
x86.h x86: Share definition of __is_canonical_address() 2024-11-18 11:43:11 +01:00