Skip to content

Commit 141b519

Browse files
sean-jcgregkh
authored andcommitted
KVM: nVMX: Defer the MMU reload to the normal path on an EPTP switch
commit c805f5d upstream. Defer reloading the MMU after a EPTP successful EPTP switch. The VMFUNC instruction itself is executed in the previous EPTP context, any side effects, e.g. updating RIP, should occur in the old context. Practically speaking, this bug is benign as VMX doesn't touch the MMU when skipping an emulated instruction, nor does queuing a single-step #DB. No other post-switch side effects exist. Fixes: 41ab937 ("KVM: nVMX: Emulate EPTP switching for the L1 hypervisor") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20210305011101.3597423-14-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 02f7450 commit 141b519

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

‎arch/x86/kvm/vmx/nested.c‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5517,16 +5517,11 @@ static int nested_vmx_eptp_switching(struct kvm_vcpu *vcpu,
55175517
if (!nested_vmx_check_eptp(vcpu, new_eptp))
55185518
return 1;
55195519

5520-
kvm_mmu_unload(vcpu);
55215520
mmu->ept_ad = accessed_dirty;
55225521
mmu->mmu_role.base.ad_disabled = !accessed_dirty;
55235522
vmcs12->ept_pointer = new_eptp;
5524-
/*
5525-
* TODO: Check what's the correct approach in case
5526-
* mmu reload fails. Currently, we just let the next
5527-
* reload potentially fail
5528-
*/
5529-
kvm_mmu_reload(vcpu);
5523+
5524+
kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu);
55305525
}
55315526

55325527
return 0;

0 commit comments

Comments
 (0)