From: Haozhong Zhang Date: Wed, 10 Jan 2018 13:44:42 +0000 (+0800) Subject: KVM MMU: check pending exception before injecting APF X-Git-Tag: v4.14.20~184 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fea5349eb88bf8e95b0574a7c7d30040c2f07c9c;p=platform%2Fkernel%2Flinux-rpi.git KVM MMU: check pending exception before injecting APF commit 2a266f23550be997d783f27e704b9b40c4010292 upstream. For example, when two APF's for page ready happen after one exit and the first one becomes pending, the second one will result in #DF. Instead, just handle the second page fault synchronously. Reported-by: Ross Zwisler Message-ID: Reported-by: Alec Blayne Signed-off-by: Haozhong Zhang Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 0fce8d7..beb7f87 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -3784,7 +3784,8 @@ static int kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn) bool kvm_can_do_async_pf(struct kvm_vcpu *vcpu) { if (unlikely(!lapic_in_kernel(vcpu) || - kvm_event_needs_reinjection(vcpu))) + kvm_event_needs_reinjection(vcpu) || + vcpu->arch.exception.pending)) return false; if (!vcpu->arch.apf.delivery_as_pf_vmexit && is_guest_mode(vcpu))