KVM: nVMX: mask unrestricted_guest if disabled on L0
authorRadim Krčmář <rkrcmar@redhat.com>
Tue, 17 Mar 2015 13:02:32 +0000 (14:02 +0100)
committerSasha Levin <sasha.levin@oracle.com>
Sun, 17 May 2015 23:12:30 +0000 (19:12 -0400)
commit24f2e905a3adb255b00e26688c6155c179747a0d
tree9ef8cce67e2f44e930ac1e9506734b697fafb899
parentd07c59df9ff1f75f5ce0a9af7e9a4b9da8739078
KVM: nVMX: mask unrestricted_guest if disabled on L0

[ Upstream commit 0790ec172de1bd2e23f1dbd4925426b6cc3c1b72 ]

If EPT was enabled, unrestricted_guest was allowed in L1 regardless of
L0.  L1 triple faulted when running L2 guest that required emulation.

Another side effect was 'WARN_ON_ONCE(vmx->nested.nested_run_pending)'
in L0's dmesg:
  WARNING: CPU: 0 PID: 0 at arch/x86/kvm/vmx.c:9190 nested_vmx_vmexit+0x96e/0xb00 [kvm_intel] ()

Prevent this scenario by masking SECONDARY_EXEC_UNRESTRICTED_GUEST when
the host doesn't have it enabled.

Fixes: 78051e3b7e35 ("KVM: nVMX: Disable unrestricted mode if ept=0")
Cc: stable@vger.kernel.org
Tested-By: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
arch/x86/kvm/vmx.c