KVM: MMU: unalias gfn before sp->gfns[] comparison in sync_page
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Thu, 13 May 2010 02:08:08 +0000 (10:08 +0800)
committerAvi Kivity <avi@redhat.com>
Sun, 1 Aug 2010 07:35:46 +0000 (10:35 +0300)
sp->gfns[] contain unaliased gfns, but gpte might contain pointer
to aliased region.

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/paging_tmpl.h

index 15e379eaf3b06d80ac7c4079ad2e1baa7df989e0..22f13797f5214914e4d1e110d6e0e0e6bf474b5a 100644 (file)
@@ -586,7 +586,7 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
                unsigned pte_access;
                pt_element_t gpte;
                gpa_t pte_gpa;
-               gfn_t gfn = sp->gfns[i];
+               gfn_t gfn;
 
                if (!is_shadow_present_pte(sp->spt[i]))
                        continue;
@@ -597,8 +597,9 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
                                          sizeof(pt_element_t)))
                        return -EINVAL;
 
-               if (gpte_to_gfn(gpte) != gfn || !is_present_gpte(gpte) ||
-                   !(gpte & PT_ACCESSED_MASK)) {
+               gfn = gpte_to_gfn(gpte);
+               if (unalias_gfn(vcpu->kvm, gfn) != sp->gfns[i] ||
+                     !is_present_gpte(gpte) || !(gpte & PT_ACCESSED_MASK)) {
                        u64 nonpresent;
 
                        rmap_remove(vcpu->kvm, &sp->spt[i]);
This page took 0.027288 seconds and 5 git commands to generate.