summaryrefslogtreecommitdiffstats
path: root/drivers/kvm/paging_tmpl.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-12-09 17:00:02 +0200
committerAvi Kivity <avi@qumranet.com>2008-01-30 17:53:20 +0200
commit41074d07c78b086b18fc2af590caef05dbcca568 (patch)
tree1e07a3d17d718d61bbb45e427c7e7980f2b7ad2e /drivers/kvm/paging_tmpl.h
parentbedbe4ee86195dcd899577828714cc1413beb571 (diff)
downloadop-kernel-dev-41074d07c78b086b18fc2af590caef05dbcca568.zip
op-kernel-dev-41074d07c78b086b18fc2af590caef05dbcca568.tar.gz
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 1fc4f9b..211fef8 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,
int offset_in_pte)
{
pt_element_t gpte;
+ unsigned pte_access;
gpte = *(const pt_element_t *)pte;
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,
if (bytes < sizeof(pt_element_t))
return;
pgprintk("%s: gpte %llx spte %p\n", __FUNCTION__, (u64)gpte, spte);
- FNAME(set_pte)(vcpu, gpte, spte, ACC_ALL, ACC_ALL,
+ pte_access = page->role.access & FNAME(gpte_access)(vcpu, gpte);
+ FNAME(set_pte)(vcpu, gpte, spte, page->role.access, pte_access,
0, 0, NULL, NULL, gpte_to_gfn(gpte));
}
OpenPOWER on IntegriCloud