[PATCH] KVM: Fix guest cr4 corruption

From: Avi Kivity
Date: Tue Nov 07 2006 - 11:05:37 EST


Upon entry to protected mode, we set cr4 to a value derived from cr0
accidentally. Fix.

This could cause a guest to crash (though I never observed it).

Signed-off-by: Avi Kivity <avi@xxxxxxxxxxxx>

Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
--- linux-2.6.orig/drivers/kvm/kvm_main.c
+++ linux-2.6/drivers/kvm/kvm_main.c
@@ -697,7 +697,7 @@ static void enter_pmode(struct kvm_vcpu
vmcs_writel(GUEST_RFLAGS, flags);

vmcs_writel(GUEST_CR4, (vmcs_readl(GUEST_CR4) & ~CR4_VME_MASK) |
- (vmcs_readl(CR0_READ_SHADOW) & CR4_VME_MASK) );
+ (vmcs_readl(CR4_READ_SHADOW) & CR4_VME_MASK));

update_exception_bitmap(vcpu);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/