KVM: MMU: add missing reserved bits check in speculative path
[firefly-linux-kernel-4.4.55.git] / arch / x86 / kvm / paging_tmpl.h
index d9a2742014e3d706a82ee7e57ab124f7f866f8d2..51ef9097960d43624b462f6f0a698553b292f362 100644 (file)
@@ -638,8 +638,9 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
                        return -EINVAL;
 
                gfn = gpte_to_gfn(gpte);
-               if (gfn != sp->gfns[i] ||
-                     !is_present_gpte(gpte) || !(gpte & PT_ACCESSED_MASK)) {
+               if (is_rsvd_bits_set(vcpu, gpte, PT_PAGE_TABLE_LEVEL)
+                     || gfn != sp->gfns[i] || !is_present_gpte(gpte)
+                     || !(gpte & PT_ACCESSED_MASK)) {
                        u64 nonpresent;
 
                        if (is_present_gpte(gpte) || !clear_unsync)