aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/paging_tmpl.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-12-09 10:00:02 -0500
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:53:20 -0500
commit41074d07c78b086b18fc2af590caef05dbcca568 (patch)
tree1e07a3d17d718d61bbb45e427c7e7980f2b7ad2e /drivers/kvm/paging_tmpl.h
parentbedbe4ee86195dcd899577828714cc1413beb571 (diff)
KVM: MMU: Fix inherited permissions for emulated guest pte updates
When we emulate a guest pte write, we fail to apply the correct inherited permissions from the parent ptes. Now that we store inherited permissions in the shadow page, we can use that to update the pte permissions correctly. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/paging_tmpl.h')
-rw-r--r--drivers/kvm/paging_tmpl.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index 1fc4f9b321ee..211fef83be5d 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -327,6 +327,7 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page,
327 int offset_in_pte) 327 int offset_in_pte)
328{ 328{
329 pt_element_t gpte; 329 pt_element_t gpte;
330 unsigned pte_access;
330 331
331 gpte = *(const pt_element_t *)pte; 332 gpte = *(const pt_element_t *)pte;
332 if (~gpte & (PT_PRESENT_MASK | PT_ACCESSED_MASK)) { 333 if (~gpte & (PT_PRESENT_MASK | PT_ACCESSED_MASK)) {
@@ -337,7 +338,8 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page,
337 if (bytes < sizeof(pt_element_t)) 338 if (bytes < sizeof(pt_element_t))
338 return; 339 return;
339 pgprintk("%s: gpte %llx spte %p\n", __FUNCTION__, (u64)gpte, spte); 340 pgprintk("%s: gpte %llx spte %p\n", __FUNCTION__, (u64)gpte, spte);
340 FNAME(set_pte)(vcpu, gpte, spte, ACC_ALL, ACC_ALL, 341 pte_access = page->role.access & FNAME(gpte_access)(vcpu, gpte);
342 FNAME(set_pte)(vcpu, gpte, spte, page->role.access, pte_access,
341 0, 0, NULL, NULL, gpte_to_gfn(gpte)); 343 0, 0, NULL, NULL, gpte_to_gfn(gpte));
342} 344}
343 345