From: Gleb Natapov Date: Mon, 27 Dec 2010 15:25:04 +0000 (+0200) Subject: KVM: VMX: when entering real mode align segment base to 16 bytes X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=444e863d13373b958ec6b133dcecf140d6c6c2ab;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git KVM: VMX: when entering real mode align segment base to 16 bytes VMX checks that base is equal segment shifted 4 bits left. Otherwise guest entry fails. Signed-off-by: Gleb Natapov Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 1896cada805f..bf89ec2cfb82 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1736,9 +1736,13 @@ static void fix_rmode_seg(int seg, struct kvm_save_segment *save) save->limit = vmcs_read32(sf->limit); save->ar = vmcs_read32(sf->ar_bytes); vmcs_write16(sf->selector, save->base >> 4); - vmcs_write32(sf->base, save->base & 0xfffff); + vmcs_write32(sf->base, save->base & 0xffff0); vmcs_write32(sf->limit, 0xffff); vmcs_write32(sf->ar_bytes, 0xf3); + if (save->base & 0xf) + printk_once(KERN_WARNING "kvm: segment base is not paragraph" + " aligned when entering protected mode (seg=%d)", + seg); } static void enter_rmode(struct kvm_vcpu *vcpu)