mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 21:02:43 +01:00
KVM: nVMX: Ensure KVM_REQ_GET_NESTED_STATE_PAGES is cleared on VM-Exit
Always check and clear KVM_REQ_GET_NESTED_STATE_PAGES when emulating a
nested VM-Exit to ensure the request is cleared, even when KVM was built
with CONFIG_KVM_HYPERV=n, as KVM subtly relies on the "check" to clear
the flag and thus avoid double-mapping the vmcs12 pages, e.g. if KVM
manages to bail from VM-Enter without processing the request, and then
emulates VMLAUNCH or VMRESUME.
Fixes: b4f69df0f6 ("KVM: x86: Make Hyper-V emulation optional")
Cc: [email protected]
Reported-by: Yosry Ahmed <[email protected]>
Reviewed-by: Yosry Ahmed <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>
This commit is contained in:
1 parent
4f05a3337d
commit
11722439fb
1 file changed
+3
-2
@@ -5081,8 +5081,9 @@ void __nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 vm_exit_reason,
|
||||
/* trying to cancel vmlaunch/vmresume is a bug */
|
||||
kvm_warn_on_nested_run_pending(vcpu);
|
||||
|
||||
#ifdef CONFIG_KVM_HYPERV
|
||||
/* Note, "checking" the request also clears the request. */
|
||||
if (kvm_check_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu)) {
|
||||
#ifdef CONFIG_KVM_HYPERV
|
||||
/*
|
||||
* KVM_REQ_GET_NESTED_STATE_PAGES is also used to map
|
||||
* Enlightened VMCS after migration and we still need to
|
||||
@@ -5090,8 +5091,8 @@ void __nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 vm_exit_reason,
|
||||
* the first L2 run.
|
||||
*/
|
||||
(void)nested_get_evmcs_page(vcpu);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Service pending TLB flush requests for L2 before switching to L1. */
|
||||
kvm_service_local_tlb_flush_requests(vcpu);
|
||||
|
||||
Reference in new issue
Block a user