Skip to content

Commit ed24ba6

Browse files
committed
KVM: selftests: Report unhandled exceptions on x86 as regular guest asserts
Now that selftests support printf() in the guest, report unexpected exceptions via the regular assertion framework. Exceptions were special cased purely to provide a better error message. Convert only x86 for now, as it's low-hanging fruit (already formats the assertion in the guest), and converting x86 will allow adding asserts in x86 library code without needing to update multiple tests. Once all other architectures are converted, this will allow moving the reporting to common code, which will in turn allow adding asserts in common library code, and will also allow removing UCALL_UNHANDLED. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent d1c2cdc commit ed24ba6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tools/testing/selftests/kvm/lib/x86_64/processor.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -566,10 +566,8 @@ void route_exception(struct ex_regs *regs)
566566
if (kvm_fixup_exception(regs))
567567
return;
568568

569-
ucall_assert(UCALL_UNHANDLED,
570-
"Unhandled exception in guest", __FILE__, __LINE__,
571-
"Unhandled exception '0x%lx' at guest RIP '0x%lx'",
572-
regs->vector, regs->rip);
569+
GUEST_FAIL("Unhandled exception '0x%lx' at guest RIP '0x%lx'",
570+
regs->vector, regs->rip);
573571
}
574572

575573
static void vm_init_descriptor_tables(struct kvm_vm *vm)
@@ -611,7 +609,7 @@ void assert_on_unhandled_exception(struct kvm_vcpu *vcpu)
611609
{
612610
struct ucall uc;
613611

614-
if (get_ucall(vcpu, &uc) == UCALL_UNHANDLED)
612+
if (get_ucall(vcpu, &uc) == UCALL_ABORT)
615613
REPORT_GUEST_ASSERT(uc);
616614
}
617615

0 commit comments

Comments
 (0)