diff mbox

[XTF,13/16] vvmx: test vmxon in VMX root w/ CPL = 0 and w/o current VMCS

Message ID 20161216134348.16236-14-haozhong.zhang@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Haozhong Zhang Dec. 16, 2016, 1:43 p.m. UTC
VMfailInvalid is expected in this test.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
---
 tests/vvmx/vmxon.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
diff mbox

Patch

diff --git a/tests/vvmx/vmxon.c b/tests/vvmx/vmxon.c
index a41f101..0664a48 100644
--- a/tests/vvmx/vmxon.c
+++ b/tests/vvmx/vmxon.c
@@ -149,6 +149,22 @@  static bool test_vmxon_correct(void)
     return handle_vmxinsn_err(__func__, ret, fault, VMXERR_NOERR, 0, 0);
 }
 
+/**
+ * vmxon in VMX root w/ CPL = 0 and w/o current VMCS
+ *
+ * Expect: VMfailInvalid
+ */
+static bool test_vmxon_in_root_cpl0_novmcs(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_INVALID, 0, 0);
+}
+
 bool test_vmxon(void)
 {
     if ( !test_vmxon_novmxe() )
@@ -175,6 +191,9 @@  bool test_vmxon(void)
     if ( !test_vmxon_correct() )
         return false;
 
+    if ( !test_vmxon_in_root_cpl0_novmcs() )
+        return false;
+
     return true;
 }