Skip to content

Commit a1b0c1c

Browse files
vittyvkbonzini
authored andcommitted
x86/kvm/nVMX: allow bare VMXON state migration
It is perfectly valid for a guest to do VMXON and not do VMPTRLD. This state needs to be preserved on migration. Cc: stable@vger.kernel.org Fixes: 8fcc4b5 Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent a7c42bb commit a1b0c1c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

arch/x86/kvm/vmx.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14827,13 +14827,6 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
1482714827
if (!page_address_valid(vcpu, kvm_state->vmx.vmxon_pa))
1482814828
return -EINVAL;
1482914829

14830-
if (kvm_state->size < sizeof(kvm_state) + sizeof(*vmcs12))
14831-
return -EINVAL;
14832-
14833-
if (kvm_state->vmx.vmcs_pa == kvm_state->vmx.vmxon_pa ||
14834-
!page_address_valid(vcpu, kvm_state->vmx.vmcs_pa))
14835-
return -EINVAL;
14836-
1483714830
if ((kvm_state->vmx.smm.flags & KVM_STATE_NESTED_SMM_GUEST_MODE) &&
1483814831
(kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE))
1483914832
return -EINVAL;
@@ -14863,6 +14856,14 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
1486314856
if (ret)
1486414857
return ret;
1486514858

14859+
/* Empty 'VMXON' state is permitted */
14860+
if (kvm_state->size < sizeof(kvm_state) + sizeof(*vmcs12))
14861+
return 0;
14862+
14863+
if (kvm_state->vmx.vmcs_pa == kvm_state->vmx.vmxon_pa ||
14864+
!page_address_valid(vcpu, kvm_state->vmx.vmcs_pa))
14865+
return -EINVAL;
14866+
1486614867
set_current_vmptr(vmx, kvm_state->vmx.vmcs_pa);
1486714868

1486814869
if (kvm_state->vmx.smm.flags & KVM_STATE_NESTED_SMM_VMXON) {

0 commit comments

Comments
 (0)