Skip to content

KVM: harden and cleanup PDPTR load on forced L1 reload

Paolo Bonzini kvm lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3KVM: nVMX: unwind PDPTR load if processor triggers a nested VMFailarch/x86/kvm/vmx/nested.c+8 -81 reply
2/3KVM: MMU: unconditionally clear MMIO cache on root rebuildarch/x86/kvm/mmu/mmu.c+1 -01 reply
3/3KVM: nVMX: remove unnecessary unload on processor-detected VMFailarch/x86/kvm/vmx/nested.c+0 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] KVM: harden and cleanup PDPTR load on forced L1 reload

Nested VMX tries to detect all possible VMFail cases before committing to execute VMLAUNCH/VMRESUME, because the steps leading to the VMCS02 VM entry need to load various bits of the L2 processor state into KVM's software model (vcpu->arch, essentially).

However, there are cases that are not caught or in some cases even racy because the data comes from memory rather than from the VMCS; in that case the earlier load of L2 state needs to be unwound, and nested_vmx_restore_host_state() exists for that purpose. Sashiko found a hole where L1's CR3 is restored there upon a VM-Entry failure, but the PDPTRs are only restored if EPT is enabled. If shadow paging is used, the L2 PDPTRs from the aborted entry attempt will remain in vcpu->arch.root_mmu->pdptrs.

Fix this by forcing use of nested_vmx_load_cr3(), in the same guise as load_vmcs12_host_state().

The other two patches are respectively another minor hardening/clarification, and a small optimization.

Paolo Bonzini (3):
KVM: nVMX: unwind PDPTR load if processor triggers a nested VMFail
KVM: MMU: unconditionally clear MMIO cache on root rebuild
KVM: nVMX: remove unnecessary unload on processor-detected VMFail

 arch/x86/kvm/mmu/mmu.c    |  1 +
 arch/x86/kvm/vmx/nested.c | 15 +++++++--------
 2 files changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
2.52.0