Skip to content

KVM: x86: Reset MMU back to the root MMU when leaving guest mode

Paolo Bonzini kvm lkml sashiko-reviews stable 1 version Applied

Status from this message: Applied patch 2 to kvm-x86 misc, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2KVM: nVMX: Reset MMU back to the root MMU if loading L2 state fails for !VM-Entryarch/x86/kvm/vmx/nested.c+3 -11 reply
2/2KVM: x86: Reset MMU back to the root MMU when leaving guest modearch/x86/kvm/regs.h arch/x86/kvm/svm/nested.c arch/x86/kvm/vmx/nested.c+3 -190 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/2] KVM: x86: Reset MMU back to the root MMU when leaving guest mode

Fix a bug where KVM fails to unwind vcpu->arch.mmu back to the root MMU after leaving guest mode on a failed entry to L2 via RSM or KVM_SET_NETSED_STATE. If KVM also frees nested state before the next entry to L1 (or maybe even after?), trying to construct the shadow root will hit a NULL pointer deref when trying to get vmcs12->eptp.

The only known instance of the bug is in patch 1; Sean's patch 2 avoids the moving the reset to the place where the vCPU goes back to L1 for both nSVM and nVMX. However, it conflicts with pre-7.3 code due to the separation of kvm_mmu and kvm_pagewalk; and it will also conflict with the stable-worthy v3 of https://lore.kernel.org/kvm/[email protected]/,
so it will only be applied to kvm/next.

Thanks,

Paolo

Amirmohammad Eftekhar (1):
KVM: nVMX: Reset MMU back to the root MMU if loading L2 state fails for !VM-Entry

Sean Christopherson (1):
KVM: x86: Reset MMU back to the root MMU when leaving guest mode

 arch/x86/kvm/regs.h       | 2 ++
 arch/x86/kvm/svm/nested.c | 8 --------
 arch/x86/kvm/vmx/nested.c | 8 --------
 3 files changed, 2 insertions(+), 16 deletions(-)
Signature · 1 line
2.56.0