Assert that PAE is set in the original CR4 value when the host is setup to VM-Exit to 64-bit mode in test_host_addr_size(). If CR4.PAE isn't set then something is wildly broken and all bets are off as VM-Enter can't possibly succeed. Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> --- x86/vmx_tests.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index 226f526d..9ec0f512 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -7620,6 +7620,8 @@ static void test_host_addr_size(void) u64 tmp; if (vmcs_read(EXI_CONTROLS) & EXI_HOST_64) { + assert(cr4_saved & X86_CR4_PAE); + vmcs_write(ENT_CONTROLS, entry_ctrl_saved | ENT_GUEST_64); report_prefix_pushf("\"IA-32e mode guest\" enabled"); test_vmx_vmlaunch(0); @@ -7640,14 +7642,10 @@ static void test_host_addr_size(void) report_prefix_pop(); } - if (cr4_saved & X86_CR4_PAE) { - vmcs_write(HOST_CR4, cr4_saved & ~X86_CR4_PAE); - report_prefix_pushf("\"CR4.PAE\" unset"); - test_vmx_vmlaunch(VMXERR_ENTRY_INVALID_HOST_STATE_FIELD); - } else { - report_prefix_pushf("\"CR4.PAE\" set"); - test_vmx_vmlaunch(0); - } + vmcs_write(HOST_CR4, cr4_saved & ~X86_CR4_PAE); + report_prefix_pushf("\"CR4.PAE\" unset"); + test_vmx_vmlaunch(VMXERR_ENTRY_INVALID_HOST_STATE_FIELD); + vmcs_write(HOST_CR4, cr4_saved); report_prefix_pop(); vmcs_write(HOST_RIP, NONCANONICAL); -- 2.42.0.283.g2d96d420d3-goog