KVM: x86/mmu: Bug the VM if a vCPU ends up in long mode without PAE enabled
[linux-2.6-microblaze.git] / arch / x86 / kvm / mmu / paging_tmpl.h
index a3fc7c1..f8d3582 100644 (file)
@@ -338,7 +338,6 @@ retry_walk:
        }
 #endif
        walker->max_level = walker->level;
-       ASSERT(!(is_long_mode(vcpu) && !is_pae(vcpu)));
 
        /*
         * FIXME: on Intel processors, loads of the PDPTE registers for PAE paging
@@ -348,6 +347,17 @@ retry_walk:
        nested_access = (have_ad ? PFERR_WRITE_MASK : 0) | PFERR_USER_MASK;
 
        pte_access = ~0;
+
+       /*
+        * Queue a page fault for injection if this assertion fails, as callers
+        * assume that walker.fault contains sane info on a walk failure.  I.e.
+        * avoid making the situation worse by inducing even worse badness
+        * between when the assertion fails and when KVM kicks the vCPU out to
+        * userspace (because the VM is bugged).
+        */
+       if (KVM_BUG_ON(is_long_mode(vcpu) && !is_pae(vcpu), vcpu->kvm))
+               goto error;
+
        ++walker->level;
 
        do {