KVM: x86: Defer the MMU unload to the normal path on an global INVPCID
authorSean Christopherson <seanjc@google.com>
Fri, 5 Mar 2021 01:10:58 +0000 (17:10 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 07:49:57 +0000 (09:49 +0200)
commit451a3e7570fc404a8a17b3dc9615ad6c79f3ebfc
treecd14793b2a6a80b8d2b7e87c55b9a6ba2a9062bc
parent14e3676e3cadb81f39b522dd66204853eaf6e104
KVM: x86: Defer the MMU unload to the normal path on an global INVPCID

commit f66c53b3b94f658590e1012bf6d922f8b7e01bda upstream.

Defer unloading the MMU after a INVPCID until the instruction emulation
has completed, i.e. until after RIP has been updated.

On VMX, this is a benign bug as VMX doesn't touch the MMU when skipping
an emulated instruction.  However, on SVM, if nrip is disabled, the
emulator is used to skip an instruction, which would lead to fireworks
if the emulator were invoked without a valid MMU.

Fixes: eb4b248e152d ("kvm: vmx: Support INVPCID in shadow paging mode")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210305011101.3597423-15-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/x86.c