diff options
author | Avi Kivity <avi@qumranet.com> | 2007-10-11 09:12:24 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:52:52 -0500 |
commit | cc70e7374df1e3a56d718e8ca330619f316511a6 (patch) | |
tree | 6746e9724eb51486104800be264e6baa64c8fefd /drivers/kvm/paging_tmpl.h | |
parent | c22e3514fceb2f514093ce1d19a2f660ac7347ae (diff) |
KVM: MMU: Disable write access on clean large pages
By forcing clean huge pages to be read-only, we have separate roles
for the shadow of a clean large page and the shadow of a dirty large
page. This is necessary because different ptes will be instantiated
for the two cases, even for read faults.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/paging_tmpl.h')
-rw-r--r-- | drivers/kvm/paging_tmpl.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index e07cb2e006c2..4538b1533d5b 100644 --- a/drivers/kvm/paging_tmpl.h +++ b/drivers/kvm/paging_tmpl.h | |||
@@ -382,6 +382,8 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, | |||
382 | metaphysical = 1; | 382 | metaphysical = 1; |
383 | hugepage_access = walker->pte; | 383 | hugepage_access = walker->pte; |
384 | hugepage_access &= PT_USER_MASK | PT_WRITABLE_MASK; | 384 | hugepage_access &= PT_USER_MASK | PT_WRITABLE_MASK; |
385 | if (!is_dirty_pte(walker->pte)) | ||
386 | hugepage_access &= ~PT_WRITABLE_MASK; | ||
385 | hugepage_access >>= PT_WRITABLE_SHIFT; | 387 | hugepage_access >>= PT_WRITABLE_SHIFT; |
386 | if (walker->pte & PT64_NX_MASK) | 388 | if (walker->pte & PT64_NX_MASK) |
387 | hugepage_access |= (1 << 2); | 389 | hugepage_access |= (1 << 2); |