KVM: MMU: Fix guest writes to nonpae pde
authorAvi Kivity <avi@qumranet.com>
Thu, 8 Mar 2007 15:13:32 +0000 (17:13 +0200)
committerAvi Kivity <avi@qumranet.com>
Sun, 18 Mar 2007 08:49:09 +0000 (10:49 +0200)
commitac1b714e78c8f0b252f8d8872e6ce6f898a123b3
tree6068b184778a7f43c92b0518eaefcf617309779b
parentf5b42c3324494ea3f9bf795e2a7e4d3cbb06c607
KVM: MMU: Fix guest writes to nonpae pde

KVM shadow page tables are always in pae mode, regardless of the guest
setting.  This means that a guest pde (mapping 4MB of memory) is mapped
to two shadow pdes (mapping 2MB each).

When the guest writes to a pte or pde, we intercept the write and emulate it.
We also remove any shadowed mappings corresponding to the write.  Since the
mmu did not account for the doubling in the number of pdes, it removed the
wrong entry, resulting in a mismatch between shadow page tables and guest
page tables, followed shortly by guest memory corruption.

This patch fixes the problem by detecting the special case of writing to
a non-pae pde and adjusting the address and number of shadow pdes zapped
accordingly.

Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/mmu.c
This page took 0.034534 seconds and 5 git commands to generate.