[PATCH 4/4] kvm-unit-test: nVMX: Test GUEST_SYSENTER_ESP and GUEST_SYSENTER_EIP on vmentry of nested guests

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

 



According to section "Checks on Guest Control Registers, Debug Registers, and
and MSRs" in Intel SDM vol 3C, the following checks are performed on vmentry
of nested guests:

    "The IA32_SYSENTER_ESP field and the IA32_SYSENTER_EIP field must each
    contain a canonical address."

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx>
Reviewed-by: Karl Heubaum <karl.heubaum@xxxxxxxxxx>
---
 x86/vmx_tests.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 5f836d4..2dbc0bf 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -7219,9 +7219,9 @@ static void test_canonical(u64 field, const char * field_name, bool host)
 			report_prefix_pop();
 		} else {
 			enter_guest();
-			report_guest_state_test("%s",
+			report_guest_state_test("Test canonical address",
 						VMX_VMCALL, addr_saved,
-						"GUEST_XXXXXXX");
+						field_name);
 		}
 
 		vmcs_write(field, NONCANONICAL);
@@ -7232,11 +7232,9 @@ static void test_canonical(u64 field, const char * field_name, bool host)
 			report_prefix_pop();
 		} else {
 			enter_guest_with_invalid_guest_state();
-			report_guest_state_test("ENT_LOAD_PAT "
-					        "enabled",
+			report_guest_state_test("Test canonical address",
 					        VMX_FAIL_STATE | VMX_ENTRY_FAILURE,
-					        addr_saved,
-					        "GUEST_PAT");
+					        NONCANONICAL, field_name);
 		}
 
 		vmcs_write(field, addr_saved);
@@ -7247,11 +7245,9 @@ static void test_canonical(u64 field, const char * field_name, bool host)
 			report_prefix_pop();
 		} else {
 			enter_guest_with_invalid_guest_state();
-			report_guest_state_test("ENT_LOAD_PAT "
-					        "enabled",
+			report_guest_state_test("Test canonical address",
 					        VMX_FAIL_STATE | VMX_ENTRY_FAILURE,
-					        addr_saved,
-					        "GUEST_PAT");
+					        NONCANONICAL, field_name);
 		}
 	}
 }
@@ -7450,6 +7446,13 @@ static void vmx_guest_state_area_test(void)
 	vmx_set_test_stage(1);
 	test_set_guest(guest_state_test_main);
 
+	/*
+	 * The IA32_SYSENTER_ESP field and the IA32_SYSENTER_EIP field
+	 * must each contain a canonical address.
+	 */
+	test_canonical(GUEST_SYSENTER_ESP, "GUEST_SYSENTER_ESP", false);
+	test_canonical(GUEST_SYSENTER_EIP, "GUEST_SYSENTER_EIP", false);
+
 	test_load_guest_pat();
 	test_guest_efer();
 	test_load_guest_perf_global_ctrl();
-- 
2.20.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux