Message ID | 20200416162814.32065-1-sean.j.christopherson@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [kvm-unit-tests] nVMX: Add testcase to cover VMWRITE to nonexistent CR3-target values | expand |
On 4/16/20 9:28 AM, Sean Christopherson wrote: > 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> > --- > x86/vmx_tests.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c > index 1f97fe3..f5c72e6 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)); > } > > /* We don't need VMREAD testing ?
On 17/04/20 03:35, Krish Sadhukhan wrote: > > On 4/16/20 9:28 AM, Sean Christopherson wrote: >> 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> >> --- >> x86/vmx_tests.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c >> index 1f97fe3..f5c72e6 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)); >> } >> /* > We don't need VMREAD testing ? Patches are welcome. :D Paolo
On 4/17/20 12:00 AM, Paolo Bonzini wrote: > On 17/04/20 03:35, Krish Sadhukhan wrote: >> On 4/16/20 9:28 AM, Sean Christopherson wrote: >>> 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> >>> --- >>> x86/vmx_tests.c | 4 ++++ >>> 1 file changed, 4 insertions(+) >>> >>> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c >>> index 1f97fe3..f5c72e6 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)); >>> } >>> /* >> We don't need VMREAD testing ? > Patches are welcome. :D > > Paolo > OK, I will send it along with my next test patch :-) Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index 1f97fe3..f5c72e6 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)); } /*
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> --- x86/vmx_tests.c | 4 ++++ 1 file changed, 4 insertions(+)