KVM: nVMX: sync vmcs02 segment regs prior to vmx_set_cr0
authorSean Christopherson <sean.j.christopherson@intel.com>
Mon, 5 Mar 2018 17:33:27 +0000 (09:33 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 23 Mar 2018 17:26:21 +0000 (18:26 +0100)
commit9d1887ef3252a45f4e692525d04e23ce8091c17c
tree82d2700fa857f56446dc28d5e9d0746818b25cd6
parente13c2ac512373d7b108ca534249b76e0da1e3334
KVM: nVMX: sync vmcs02 segment regs prior to vmx_set_cr0

Segment registers must be synchronized prior to any code that may
trigger a call to emulation_required()/guest_state_valid(), e.g.
vmx_set_cr0().  Because preparing vmcs02 writes segmentation fields
directly, i.e. doesn't use vmx_set_segment(), emulation_required
will not be re-evaluated when synchronizing the segment registers,
which can result in L0 incorrectly starting emulation of L2.

Fixes: 8665c3f97320 ("KVM: nVMX: initialize descriptor cache fields in prepare_vmcs02_full")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
[Move all of prepare_vmcs02_full earlier, not just segment registers. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c