[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [XTF PATCH 15/16] vvmx: test vmxon in VMX root w/ CPL = 0 and w/ current VMCS
VMfailvalid(15) is expected in this test. Signed-off-by: Haozhong Zhang <haozhong.zhang@xxxxxxxxx> --- tests/vvmx/vmxon.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/vvmx/vmxon.c b/tests/vvmx/vmxon.c index ec7ee7e..705a04d 100644 --- a/tests/vvmx/vmxon.c +++ b/tests/vvmx/vmxon.c @@ -4,6 +4,7 @@ static uint8_t vmxon_region[PAGE_SIZE] __aligned(PAGE_SIZE); static uint8_t vmxon_region_2nd[PAGE_SIZE] __aligned(PAGE_SIZE); +static uint8_t vmcs[PAGE_SIZE] __aligned(PAGE_SIZE); /** * vmxon with CR4.VMXE cleared @@ -191,6 +192,23 @@ static bool test_vmxon_in_root_user_novmcs(void) VMXERR_FAULT, EXINFO_SYM(GP, 0), 0); } +/** + * vmxon in VMX root w/ CPL = 0 and w/ current VMCS + * + * Expect: VMfailvalid(15) + */ +static bool test_vmxon_in_root_cpl0_vmcs(void) +{ + clear_vmcs(vmxon_region_2nd, get_vmcs_revid()); + + exinfo_t fault; + uint8_t ret = vmxon((uint64_t)vmxon_region_2nd, &fault); + + return handle_vmxinsn_err(__func__, ret, fault, + VMXERR_VMFAIL_VALID, 0, + VMX_INSN_VMXON_IN_VMX_ROOT); +} + bool test_vmxon(void) { if ( !test_vmxon_novmxe() ) @@ -223,6 +241,17 @@ bool test_vmxon(void) if ( !test_vmxon_in_root_user_novmcs() ) return false; + clear_vmcs(vmcs, get_vmcs_revid()); + if ( vmptrld((uint64_t)vmcs, NULL) ) + { + xtf_failure("Fail: %s: unexpected failure from vmptrld 0x%"PRIx64"\n", + __func__, (uint64_t)vmcs); + return false; + } + + if ( !test_vmxon_in_root_cpl0_vmcs() ) + return false; + return true; } -- 2.10.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |