From: Marcelo Tosatti <[email protected]>

If a pagetable contains a writeable large spte, all of its sptes will be
write protected, including non-leaf ones, leading to endless pagefaults.

Do not write protect pages above PT_PAGE_TABLE_LEVEL, as the spte fault
paths assume non-leaf sptes are writable.

Tested-by: Alex Williamson <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 113cfd6..612b565 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3444,6 +3444,9 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, 
int slot)
                if (!test_bit(slot, sp->slot_bitmap))
                        continue;
 
+               if (sp->role.level != PT_PAGE_TABLE_LEVEL)
+                       continue;
+
                pt = sp->spt;
                for (i = 0; i < PT64_ENT_PER_PAGE; ++i)
                        /* avoid RMW */
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to