Skip to content

Commit 78051e3

Browse files
whitebrandybonzini
authored andcommitted
KVM: nVMX: Disable unrestricted mode if ept=0
If L0 has disabled EPT, don't advertise unrestricted mode at all since it depends on EPT to run real mode code. Fixes: 92fbc7b Cc: stable@vger.kernel.org Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Bandan Das <bsd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 64a3829 commit 78051e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kvm/vmx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,13 +2399,13 @@ static __init void nested_vmx_setup_ctls_msrs(void)
23992399
nested_vmx_secondary_ctls_low = 0;
24002400
nested_vmx_secondary_ctls_high &=
24012401
SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
2402-
SECONDARY_EXEC_UNRESTRICTED_GUEST |
24032402
SECONDARY_EXEC_WBINVD_EXITING |
24042403
SECONDARY_EXEC_XSAVES;
24052404

24062405
if (enable_ept) {
24072406
/* nested EPT: emulate EPT also to L1 */
2408-
nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT;
2407+
nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT |
2408+
SECONDARY_EXEC_UNRESTRICTED_GUEST;
24092409
nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT |
24102410
VMX_EPTP_WB_BIT | VMX_EPT_2MB_PAGE_BIT |
24112411
VMX_EPT_INVEPT_BIT;

0 commit comments

Comments
 (0)