diff options
author | Sean Christopherson <sean.j.christopherson@intel.com> | 2020-09-23 21:44:52 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-09-28 14:57:49 +0300 |
commit | 138534a810aa6aa3a6f27ac36ac52c0c685859a1 (patch) | |
tree | a86f0f6bda7b2fbdf0c8d397cd37732420c8807d /arch/x86 | |
parent | ebec153a056108ca7818caad549d3ad7c0f2369d (diff) | |
download | linux-138534a810aa6aa3a6f27ac36ac52c0c685859a1.tar.xz |
KVM: nVMX: WARN on attempt to switch the currently loaded VMCS
WARN if KVM attempts to switch to the currently loaded VMCS. Now that
nested_vmx_free_vcpu() doesn't blindly call vmx_switch_vmcs(), all paths
that lead to vmx_switch_vmcs() are implicitly guarded by guest vs. host
mode, e.g. KVM should never emulate VMX instructions when guest mode is
active, and nested_vmx_vmexit() should never be called when host mode is
active.
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200923184452.980-8-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/vmx/nested.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index bfd69fcefc72..7911c2797220 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -258,7 +258,7 @@ static void vmx_switch_vmcs(struct kvm_vcpu *vcpu, struct loaded_vmcs *vmcs) struct loaded_vmcs *prev; int cpu; - if (vmx->loaded_vmcs == vmcs) + if (WARN_ON_ONCE(vmx->loaded_vmcs == vmcs)) return; cpu = get_cpu(); |