nVMX: Add testcase to cover VMWRITE to nonexistent CR3-target values
PATCH 1/1 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.
--- x86/vmx_tests.c | 4 ++++ 1 file changed, 4 insertions(+)
x86/vmx_tests.c +4 -0
@@ -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 )); }/*
Signature · 1 line
2.26.0
Quoted 13 lines · Sean Christopherson
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 <[email protected]>--- x86/vmx_tests.c | 4 ++++ 1 file changed, 4 insertions(+)x86/vmx_tests.c +0
-0
x86/vmx_tests.c static void test_cr3_targets(void) · line 3579
Quoted 10 lines
x86/vmx_tests.c +4
-0@@ -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 )); }/*
We don't need VMREAD testing ?
Paolo Bonzini
maintainerQuoted 10 lines · Krish Sadhukhan
Quoted 8 lines · Sean Christopherson
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 <[email protected]>---
x86/vmx_tests.c| 4 ++++1 file changed, 4 insertions(+)
Quoted 15 lines
Quoted 5 lines
x86/vmx_tests.c +0
-0x86/vmx_tests.c static void test_cr3_targets(void) · line 3578
Quoted 9 lines
x86/vmx_tests.c +4
-0@@ -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)); } /*We don't need VMREAD testing ?
Patches are welcome. :D
Paolo
Krish Sadhukhan
Reviewed-byQuoted 25 lines · Paolo Bonzini
Quoted 9 lines · Krish Sadhukhan
Quoted 8 lines · Sean Christopherson
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 <[email protected]>--- x86/vmx_tests.c | 4 ++++ 1 file changed, 4 insertions(+)Quoted 15 lines
Quoted 5 lines
x86/vmx_tests.c +0
-0x86/vmx_tests.c static void test_cr3_targets(void) · line 3578
Quoted 9 lines
x86/vmx_tests.c +4
-0@@ -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)); } /*We don't need VMREAD testing ?
Quoted 4 lines
Patches are welcome. :D
Paolo
OK, I will send it along with my next test patch :-)