KVM: MMU: Fix host memory corruption on i386 with >= 4GB ram
commit27aba76615eeb36af84118e8ea6d35ffa51fd1e3
authorAvi Kivity <avi@qumranet.com>
Fri, 9 Mar 2007 11:04:31 +0000 (9 13:04 +0200)
committerAvi Kivity <avi@qumranet.com>
Sun, 18 Mar 2007 08:49:09 +0000 (18 10:49 +0200)
tree8bd933f47eb91818c2e24cb10a4d820f0abea74e
parentac1b714e78c8f0b252f8d8872e6ce6f898a123b3
KVM: MMU: Fix host memory corruption on i386 with >= 4GB ram

PAGE_MASK is an unsigned long, so using it to mask physical addresses on
i386 (which are 64-bit wide) leads to truncation.  This can result in
page->private of unrelated memory pages being modified, with disasterous
results.

Fix by not using PAGE_MASK for physical addresses; instead calculate
the correct value directly from PAGE_SIZE.  Also fix a similar BUG_ON().

Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/mmu.c