Commit 6d05a965 authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov Committed by Paolo Bonzini

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: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 41b0552a
...@@ -72,6 +72,10 @@ void guest_code(struct vmx_pages *vmx_pages) ...@@ -72,6 +72,10 @@ void guest_code(struct vmx_pages *vmx_pages)
l1_guest_code(vmx_pages); l1_guest_code(vmx_pages);
GUEST_DONE(); 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[]) int main(int argc, char *argv[])
...@@ -120,7 +124,7 @@ int main(int argc, char *argv[]) ...@@ -120,7 +124,7 @@ int main(int argc, char *argv[])
case UCALL_SYNC: case UCALL_SYNC:
break; break;
case UCALL_DONE: case UCALL_DONE:
goto done; goto part1_done;
default: default:
TEST_FAIL("Unknown ucall %lu", uc.cmd); TEST_FAIL("Unknown ucall %lu", uc.cmd);
} }
...@@ -152,6 +156,10 @@ int main(int argc, char *argv[]) ...@@ -152,6 +156,10 @@ int main(int argc, char *argv[])
(ulong) regs2.rdi, (ulong) regs2.rsi); (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); kvm_vm_free(vm);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment