Skip to content

Commit

Permalink
KVM: selftests: test enlightened vmenter with wrong eVMCS version
Browse files Browse the repository at this point in the history
Check that VMfailInvalid happens when eVMCS revision is is invalid.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Vitaly Kuznetsov authored and Paolo Bonzini committed Mar 16, 2020
1 parent 7bcf732 commit 41b0552
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tools/testing/selftests/kvm/x86_64/evmcs_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

void l2_guest_code(void)
{
GUEST_SYNC(6);

GUEST_SYNC(7);

GUEST_SYNC(8);

/* Done, exit to L1 and never come back. */
vmcall();
}
Expand All @@ -50,12 +50,17 @@ void l1_guest_code(struct vmx_pages *vmx_pages)

GUEST_SYNC(5);
GUEST_ASSERT(vmptrstz() == vmx_pages->enlightened_vmcs_gpa);
current_evmcs->revision_id = -1u;
GUEST_ASSERT(vmlaunch());
current_evmcs->revision_id = EVMCS_VERSION;
GUEST_SYNC(6);

GUEST_ASSERT(!vmlaunch());
GUEST_ASSERT(vmptrstz() == vmx_pages->enlightened_vmcs_gpa);
GUEST_SYNC(8);
GUEST_SYNC(9);
GUEST_ASSERT(!vmresume());
GUEST_ASSERT(vmreadz(VM_EXIT_REASON) == EXIT_REASON_VMCALL);
GUEST_SYNC(9);
GUEST_SYNC(10);
}

void guest_code(struct vmx_pages *vmx_pages)
Expand Down

0 comments on commit 41b0552

Please sign in to comment.