KVM: nSVM: fix condition for filtering async PF
authorPaolo Bonzini <pbonzini@redhat.com>
Sat, 16 May 2020 13:19:06 +0000 (09:19 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 27 May 2020 17:11:10 +0000 (13:11 -0400)
Async page faults have to be trapped in the host (L1 in this case),
since the APF reason was passed from L0 to L1 and stored in the L1 APF
data page.  This was completely reversed: the page faults were passed
to the guest, a L2 hypervisor.

Cc: stable@vger.kernel.org
Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/nested.c

index a89a166d1cb80d3e18cee5941b6d14688adef342..f4cd2d0cc360de7bd7393500219d186398a65cf1 100644 (file)
@@ -880,8 +880,8 @@ int nested_svm_exit_special(struct vcpu_svm *svm)
                        return NESTED_EXIT_HOST;
                break;
        case SVM_EXIT_EXCP_BASE + PF_VECTOR:
-               /* When we're shadowing, trap PFs, but not async PF */
-               if (!npt_enabled && svm->vcpu.arch.apf.host_apf_reason == 0)
+               /* Trap async PF even if not shadowing */
+               if (!npt_enabled || svm->vcpu.arch.apf.host_apf_reason)
                        return NESTED_EXIT_HOST;
                break;
        default: