KVM: MMU: Fix hugepage pdes mapping same physical address with different access
authorAvi Kivity <avi@qumranet.com>
Fri, 23 Mar 2007 07:55:25 +0000 (09:55 +0200)
committerAvi Kivity <avi@qumranet.com>
Thu, 3 May 2007 07:52:27 +0000 (10:52 +0300)
commitd28c6cfbbc5e2d4fccfe6d733995ed5971ca87f6
tree0da31407f97a92c81d189b18608e54ad2064ebad
parent916ce2360fadc71d924e02403b31280112a31280
KVM: MMU: Fix hugepage pdes mapping same physical address with different access

The kvm mmu keeps a shadow page for hugepage pdes; if several such pdes map
the same physical address, they share the same shadow page.  This is a fairly
common case (kernel mappings on i386 nonpae Linux, for example).

However, if the two pdes map the same memory but with different permissions, kvm
will happily use the cached shadow page.  If the access through the more
permissive pde will occur after the access to the strict pde, an endless pagefault
loop will be generated and the guest will make no progress.

Fix by making the access permissions part of the cache lookup key.

The fix allows Xen pae to boot on kvm and run guest domains.

Thanks to Jeremy Fitzhardinge for reporting the bug and testing the fix.

Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/kvm.h
drivers/kvm/mmu.c
drivers/kvm/paging_tmpl.h