KVM: MMU: Segregate shadow pages with different cr0.wp
commit3b2711485ef5ef6ee3c0e0079ce5c4817d09b55e
authorAvi Kivity <avi@redhat.com>
Wed, 12 May 2010 08:48:18 +0000 (12 11:48 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:11:18 +0000 (5 11:11 -0700)
treea5f737c4a07d46e4c736e5776169c0f949609310
parente4a13296e7e92ddd73fa078906744d73f7d470ff
KVM: MMU: Segregate shadow pages with different cr0.wp

When cr0.wp=0, we may shadow a gpte having u/s=1 and r/w=0 with an spte
having u/s=0 and r/w=1.  This allows excessive access if the guest sets
cr0.wp=1 and accesses through this spte.

Fix by making cr0.wp part of the base role; we'll have different sptes for
the two cases and the problem disappears.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
(cherry picked from commit 3dbe141595faa48a067add3e47bba3205b79d33c)
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu.c