aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2020-04-16 09:28:14 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2020-04-23 12:16:25 -0400
commit7af4533e9ceae1e2b610d8b085daa0f2f9c726ad (patch)
tree99eb5dc44c5780b770028705e8537ac432036159
parent8634a26634c20d724d06a3e6717e44efb4915413 (diff)
downloadkvm-unit-tests-7af4533e9ceae1e2b610d8b085daa0f2f9c726ad.tar.gz
nVMX: Add testcase to cover VMWRITE to nonexistent CR3-target values
Enhance test_cr3_targets() to verify that attempting to write CR3-target value fields beyond the reported number of supported targets fails. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Message-Id: <20200416162814.32065-1-sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--x86/vmx_tests.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 4a3c56b..a7ec331 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -3570,6 +3570,10 @@ static void test_cr3_targets(void)
for (i = 0; i <= supported_targets + 1; i++)
try_cr3_target_count(i, supported_targets);
vmcs_write(CR3_TARGET_COUNT, cr3_targets);
+
+ /* VMWRITE to nonexistent target fields should fail. */
+ for (i = supported_targets; i < 256; i++)
+ TEST_ASSERT(vmcs_write(CR3_TARGET_0 + i*2, 0));
}
/*