]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/commitdiff
KVM: VMX: fix DPL during entry to protected mode
authorGleb Natapov <gleb@redhat.com>
Tue, 11 Dec 2012 13:14:10 +0000 (15:14 +0200)
committerMarcelo Tosatti <mtosatti@redhat.com>
Tue, 11 Dec 2012 23:00:27 +0000 (21:00 -0200)
On CPUs without support for unrestricted guests DPL cannot be smaller
than RPL for data segments during guest entry, but this state can occurs
if a data segment selector changes while vcpu is in real mode to a value
with lowest two bits != 00. Fix that by forcing DPL == RPL on transition
to protected mode.

This is a regression introduced by c865c43de66dc97.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/vmx.c

index 1a30fd5c3fb2b63ac52f2b8ddb81e7f8e6404271..feab3d973b681f4cac2cbd92a0211d4ae2278556 100644 (file)
@@ -2766,6 +2766,7 @@ static void fix_pmode_dataseg(struct kvm_vcpu *vcpu, int seg, struct kvm_segment
        if (!(vmcs_readl(sf->base) == tmp.base && tmp.s)) {
                tmp.base = vmcs_readl(sf->base);
                tmp.selector = vmcs_read16(sf->selector);
+               tmp.dpl = tmp.selector & SELECTOR_RPL_MASK;
                tmp.s = 1;
        }
        vmx_set_segment(vcpu, &tmp, seg);