]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: nVMX: Sync unsync'd vmcs02 state to vmcs12 on migration
authorMaxim Levitsky <mlevitsk@redhat.com>
Thu, 14 Jan 2021 20:54:47 +0000 (22:54 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 25 Jan 2021 23:52:09 +0000 (18:52 -0500)
commit6cb9b3a881b36b69b3abeb05ad7954df0873efbb
treef38846794f4c80f71ab66c9e36b60630e51da28f
parent93512734b32fb80ce7f42ac75c7a9731b320d847
KVM: nVMX: Sync unsync'd vmcs02 state to vmcs12 on migration

Even when we are outside the nested guest, some vmcs02 fields
may not be in sync vs vmcs12.  This is intentional, even across
nested VM-exit, because the sync can be delayed until the nested
hypervisor performs a VMCLEAR or a VMREAD/VMWRITE that affects those
rarely accessed fields.

However, during KVM_GET_NESTED_STATE, the vmcs12 has to be up to date to
be able to restore it.  To fix that, call copy_vmcs02_to_vmcs12_rare()
before the vmcs12 contents are copied to userspace.

Fixes: b0955aa24ea44 ("KVM: nVMX: Sync rarely accessed guest fields only when needed")
Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20210114205449.8715-2-mlevitsk@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/nested.c