@@ -209,6 +209,23 @@ static bool test_vmxon_in_root_cpl0_vmcs(void)
VMX_INSN_VMXON_IN_VMX_ROOT);
}
+/**
+ * vmxon in VMX root w/ CPL = 3 and w/ current VMCS
+ *
+ * Expect: #GP(0)
+ */
+static bool test_vmxon_in_root_user_vmcs(void)
+{
+ clear_vmcs(vmxon_region_2nd, get_vmcs_revid());
+
+ unsigned long ret = exec_user(vmxon_in_root_user);
+ uint8_t err = (ret >> 32) & 0xff;
+ exinfo_t fault = ret & 0xffffffff;
+
+ return handle_vmxinsn_err(__func__, err, fault,
+ VMXERR_FAULT, EXINFO_SYM(GP, 0), 0);
+}
+
bool test_vmxon(void)
{
if ( !test_vmxon_novmxe() )
@@ -252,6 +269,9 @@ bool test_vmxon(void)
if ( !test_vmxon_in_root_cpl0_vmcs() )
return false;
+ if ( !test_vmxon_in_root_user_vmcs() )
+ return false;
+
return true;
}
Fault #GP(0) is expected in this test. Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com> --- tests/vvmx/vmxon.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)