[PATCH 3/3] kvm-unit-tests: nVMX: Test GUEST_LIMIT_GDTR and GUEST_LIMIT_IDTR on vmentry of nested guests

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

 



According to section "Checks on Guest Descriptor-Table Registers" in Intel
SDM vol 3C, the following checks are performed on the Guest Descriptor-Table
Registers on vmentry of nested guests:

    - Bits 31:16 of each limit field must be 0.

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx>
---
 x86/vmx_tests.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index f400408..7b6205d 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -7836,6 +7836,17 @@ static void vmx_guest_state_area_test(void)
 	test_canonical(GUEST_BASE_IDTR, "GUEST_BASE_IDTR", false);
 #endif
 
+	u32 guest_desc_limit_saved = vmcs_read(GUEST_LIMIT_GDTR);
+	TEST_GUEST_VMCS_FIELD_RESERVED_BITS(16, 31, 4, GUEST_LIMIT_GDTR,
+	    "GUEST_LIMIT_GDTR", guest_desc_limit_saved, "GUEST_LIMIT_GDTR",
+	    true);
+	vmcs_write(GUEST_LIMIT_GDTR, guest_desc_limit_saved);
+	guest_desc_limit_saved = vmcs_read(GUEST_LIMIT_IDTR);
+	TEST_GUEST_VMCS_FIELD_RESERVED_BITS(16, 31, 4, GUEST_LIMIT_IDTR,
+	    "GUEST_LIMIT_IDTR", guest_desc_limit_saved, "GUEST_LIMIT_IDTR",
+	    true);
+	vmcs_write(GUEST_LIMIT_IDTR, guest_desc_limit_saved);
+
 	/*
 	 * Let the guest finish execution
 	 */
-- 
1.8.3.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