[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [XTF PATCH 16/16] vvmx: test vmxon in VMX root w/ CPL = 3 and w/ current VMCS



Fault #GP(0) is expected in this test.

Signed-off-by: Haozhong Zhang <haozhong.zhang@xxxxxxxxx>
---
 tests/vvmx/vmxon.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tests/vvmx/vmxon.c b/tests/vvmx/vmxon.c
index 705a04d..c8f2852 100644
--- a/tests/vvmx/vmxon.c
+++ b/tests/vvmx/vmxon.c
@@ -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;
 }
 
-- 
2.10.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.