repository: /home/avi/kvm/linux-2.6
branch: master
commit 3912743d04e8c68af85996b15473035d26d9e34d
Author: Avi Kivity <[EMAIL PROTECTED]>
Date:   Thu Oct 18 17:35:57 2007 +0200

    KVM: MMU: Fix dirty bit pte gpa calculation
    
    The host physical address has no business in there.
    
    Noticed by Izik Eidus.
    
    Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>

diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index f274ae9..fc23cc1 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -154,15 +154,13 @@ static int FNAME(walk_addr)(struct guest_walker *walker,
        kvm_release_page(page);
 
        if (write_fault && !is_dirty_pte(pte)) {
-               hpa_t hpa;
-
                mark_page_dirty(vcpu->kvm, table_gfn);
                pte |= PT_DIRTY_MASK;
                table = kmap_atomic(page, KM_USER0);
                table[index] = pte;
                kunmap_atomic(table, KM_USER0);
-               hpa = gpa_to_hpa(vcpu->kvm, pte & PT64_BASE_ADDR_MASK);
-               pte_gpa = hpa + index * sizeof(pt_element_t);
+               pte_gpa = table_gfn << PAGE_SHIFT;
+               pte_gpa += index * sizeof(pt_element_t);
                kvm_mmu_pte_write(vcpu, pte_gpa, (u8 *)&pte, sizeof(pte));
                kvm_release_page(pfn_to_page((hpa & PT64_BASE_ADDR_MASK)
                                             >> PAGE_SHIFT));

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-commits mailing list
kvm-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-commits

Reply via email to