diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2020-03-09 16:52:16 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-03-16 18:19:32 +0100 |
commit | 6d05a965addbea9c95eed7ab66594fd4fdf33e4c (patch) | |
tree | 8c6e91264a947e41642277f4f6e226899be3708e /tools/testing | |
parent | 41b0552aa6931a633589f76981fad7850f3ecfe5 (diff) | |
download | linux-stable-6d05a965addbea9c95eed7ab66594fd4fdf33e4c.tar.gz linux-stable-6d05a965addbea9c95eed7ab66594fd4fdf33e4c.tar.bz2 linux-stable-6d05a965addbea9c95eed7ab66594fd4fdf33e4c.zip |
KVM: selftests: enlightened VMPTRLD with an incorrect GPA
Check that guest doesn't hang when an invalid eVMCS GPA is specified.
Testing that #UD is injected would probably be better but selftests lack
the infrastructure currently.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing')
-rw-r--r-- | tools/testing/selftests/kvm/x86_64/evmcs_test.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/evmcs_test.c b/tools/testing/selftests/kvm/x86_64/evmcs_test.c index 17da5792c2f7..e6e62e5e75b2 100644 --- a/tools/testing/selftests/kvm/x86_64/evmcs_test.c +++ b/tools/testing/selftests/kvm/x86_64/evmcs_test.c @@ -72,6 +72,10 @@ void guest_code(struct vmx_pages *vmx_pages) l1_guest_code(vmx_pages); GUEST_DONE(); + + /* Try enlightened vmptrld with an incorrect GPA */ + evmcs_vmptrld(0xdeadbeef, vmx_pages->enlightened_vmcs); + GUEST_ASSERT(vmlaunch()); } int main(int argc, char *argv[]) @@ -120,7 +124,7 @@ int main(int argc, char *argv[]) case UCALL_SYNC: break; case UCALL_DONE: - goto done; + goto part1_done; default: TEST_FAIL("Unknown ucall %lu", uc.cmd); } @@ -152,6 +156,10 @@ int main(int argc, char *argv[]) (ulong) regs2.rdi, (ulong) regs2.rsi); } -done: +part1_done: + _vcpu_run(vm, VCPU_ID); + TEST_ASSERT(run->exit_reason == KVM_EXIT_SHUTDOWN, + "Unexpected successful VMEnter with invalid eVMCS pointer!"); + kvm_vm_free(vm); } |