[PATCH] kvm-unit-tests: nSVM: Test that CR0[63:32] are not set on VMRUN of nested guests

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

 



According to section "Canonicalization and Consistency Checks" in APM vol. 2,
the following guest state is illegal:

	"CR0[63:32] are not zero."

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

diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index 8bdefc5..3bfa484 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -1387,6 +1387,20 @@ static void svm_guest_state_test(void)
 	vmcb->save.cr0 = cr0;
 	report (svm_vmrun() == SVM_EXIT_ERR, "CR0: %lx", cr0);
 	vmcb->save.cr0 = cr0_saved;
+
+	/*
+	 * CR0[63:32] are not zero
+	 */
+	int i;
+
+	cr0 = cr0_saved;
+	for (i = 32; i < 63; i = i + 4) {
+		cr0 = cr0_saved | (1ull << i);
+		vmcb->save.cr0 = cr0;
+		report (svm_vmrun() == SVM_EXIT_ERR, "CR0[63:32]: %lx",
+		    cr0 >> 32);
+	}
+	vmcb->save.cr0 = cr0_saved;
 }
 
 struct svm_test svm_tests[] = {
-- 
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