|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [XTF PATCH 14/16] vvmx: test vmxon in VMX root w/ CPL = 3 and w/o current VMCS
Fault #GP(0) 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 0664a48..ec7ee7e 100644
--- a/tests/vvmx/vmxon.c
+++ b/tests/vvmx/vmxon.c
@@ -3,6 +3,7 @@
#include "util.h"
static uint8_t vmxon_region[PAGE_SIZE] __aligned(PAGE_SIZE);
+static uint8_t vmxon_region_2nd[PAGE_SIZE] __aligned(PAGE_SIZE);
/**
* vmxon with CR4.VMXE cleared
@@ -165,6 +166,31 @@ static bool test_vmxon_in_root_cpl0_novmcs(void)
VMXERR_VMFAIL_INVALID, 0, 0);
}
+static unsigned long vmxon_in_root_user(void)
+{
+ exinfo_t fault;
+ unsigned long ret = vmxon((uint64_t)vmxon_region_2nd, &fault);
+
+ return (ret << 32) | fault;
+}
+
+/**
+ * vmxon in VMX root w/ CPL = 3 and w/o current VMCS
+ *
+ * Expect: #GP(0)
+ */
+static bool test_vmxon_in_root_user_novmcs(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() )
@@ -194,6 +220,9 @@ bool test_vmxon(void)
if ( !test_vmxon_in_root_cpl0_novmcs() )
return false;
+ if ( !test_vmxon_in_root_user_novmcs() )
+ 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 |