]> git.karo-electronics.de Git - linux-beck.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>
Sun, 1 Aug 2010 07:39:23 +0000 (10:39 +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 9f4be0114bce7cca8e38a79292c7bd8a428cdfec..69d40a6e1e68fa39d6b4dcfe0a014690fbbba6a4 100644 (file)
@@ -1882,7 +1882,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)) {