]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: MMU: Allow spte.w=1 for gpte.w=0 and cr0.wp=0 only in shadow mode
authorAvi Kivity <avi@redhat.com>
Thu, 27 May 2010 11:22:51 +0000 (14:22 +0300)
committerAvi Kivity <avi@redhat.com>
Thu, 27 May 2010 12:34:13 +0000 (15:34 +0300)
When tdp is enabled, the guest's cr0.wp shouldn't have any effect on spte
permissions.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/mmu.c

index 136e1603076c35b0feb9bb2b8ce876ffc1f62835..39dd8d3120a33ea690feaba4b42d8d54d18c21d1 100644 (file)
@@ -1881,7 +1881,8 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
        spte |= (u64)pfn << PAGE_SHIFT;
 
        if ((pte_access & ACC_WRITE_MASK)
-           || (write_fault && !is_write_protection(vcpu) && !user_fault)) {
+           || (!tdp_enabled && write_fault && !is_write_protection(vcpu)
+               && !user_fault)) {
 
                if (level > PT_PAGE_TABLE_LEVEL &&
                    has_wrprotected_page(vcpu->kvm, gfn, level)) {