KVM: nVMX: Unconditionally uninit the MMU on nested vmexit
authorJan Kiszka <jan.kiszka@web.de>
Sat, 28 Dec 2013 15:31:52 +0000 (16:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2014 20:25:12 +0000 (12:25 -0800)
commit366aaa038f472c47493fb6502f58377363d100bc
treefef9d3cfc4830d1c74ef8986588eed4b91d55ce4
parentd10d0a2337097fa907f22af6ad0ae0dc0ff39fbf
KVM: nVMX: Unconditionally uninit the MMU on nested vmexit

commit 29bf08f12b2fd72b882da0d85b7385e4a438a297 upstream.

Three reasons for doing this: 1. arch.walk_mmu points to arch.mmu anyway
in case nested EPT wasn't in use. 2. this aligns VMX with SVM. But 3. is
most important: nested_cpu_has_ept(vmcs12) queries the VMCS page, and if
one guest VCPU manipulates the page of another VCPU in L2, we may be
fooled to skip over the nested_ept_uninit_mmu_context, leaving mmu in
nested state. That can crash the host later on if nested_ept_get_cr3 is
invoked while L1 already left vmxon and nested.current_vmcs12 became
NULL therefore.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/vmx.c