KVM: MMU: Fix torn shadow pte
authorAvi Kivity <avi@qumranet.com>
Fri, 22 Aug 2008 16:19:38 +0000 (19:19 +0300)
committerAvi Kivity <avi@qumranet.com>
Mon, 25 Aug 2008 14:24:27 +0000 (17:24 +0300)
The shadow code assigns a pte directly in one place, which is nonatomic on
i386 can can cause random memory references.  Fix by using an atomic setter.

Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/paging_tmpl.h

index f72ac1fa35f0bfe07b74b43f2275c28402518c9e..4a814bff21f27cb9b829df36071ffb40b43818ca 100644 (file)
@@ -345,7 +345,7 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
                shadow_addr = __pa(shadow_page->spt);
                shadow_pte = shadow_addr | PT_PRESENT_MASK | PT_ACCESSED_MASK
                        | PT_WRITABLE_MASK | PT_USER_MASK;
-               *shadow_ent = shadow_pte;
+               set_shadow_pte(shadow_ent, shadow_pte);
        }
 
        mmu_set_spte(vcpu, shadow_ent, access, walker->pte_access & access,