Skip to content

Commit 18712c1

Browse files
sean-jcbonzini
authored andcommitted
KVM: nVMX: Use vmx_need_pf_intercept() when deciding if L0 wants a #PF
Use vmx_need_pf_intercept() when determining if L0 wants to handle a #PF in L2 or if the VM-Exit should be forwarded to L1. The current logic fails to account for the case where #PF is intercepted to handle guest.MAXPHYADDR < host.MAXPHYADDR and ends up reflecting all #PFs into L1. At best, L1 will complain and inject the #PF back into L2. At worst, L1 will eat the unexpected fault and cause L2 to hang on infinite page faults. Note, while the bug was technically introduced by the commit that added support for the MAXPHYADDR madness, the shame is all on commit a0c1343 ("KVM: VMX: introduce vmx_need_pf_intercept"). Fixes: 1dbf5d6 ("KVM: VMX: Add guest physical address check in EPT violation and misconfig") Cc: [email protected] Cc: Peter Shier <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Jim Mattson <[email protected]> Signed-off-by: Sean Christopherson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 85aa888 commit 18712c1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kvm/vmx/nested.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5855,7 +5855,8 @@ static bool nested_vmx_l0_wants_exit(struct kvm_vcpu *vcpu,
58555855
if (is_nmi(intr_info))
58565856
return true;
58575857
else if (is_page_fault(intr_info))
5858-
return vcpu->arch.apf.host_apf_flags || !enable_ept;
5858+
return vcpu->arch.apf.host_apf_flags ||
5859+
vmx_need_pf_intercept(vcpu);
58595860
else if (is_debug(intr_info) &&
58605861
vcpu->guest_debug &
58615862
(KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))

0 commit comments

Comments
 (0)