Skip to content

Commit d6533c1

Browse files
committed
KVM: selftests: Check for a potential unhandled exception iff KVM_RUN succeeded
Don't check for an unhandled exception if KVM_RUN failed, e.g. if it returned errno=EFAULT, as reporting unhandled exceptions is done via a ucall, i.e. requires KVM_RUN to exit cleanly. Theoretically, checking for a ucall on a failed KVM_RUN could get a false positive, e.g. if there were stale data in vcpu->run from a previous exit. Reviewed-by: James Houghton <jthoughton@google.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Link: https://lore.kernel.org/r/20241128005547.4077116-5-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent fe85ce3 commit d6533c1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tools/testing/selftests/kvm/lib/kvm_util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,8 @@ int _vcpu_run(struct kvm_vcpu *vcpu)
16481648
rc = __vcpu_run(vcpu);
16491649
} while (rc == -1 && errno == EINTR);
16501650

1651-
assert_on_unhandled_exception(vcpu);
1651+
if (!rc)
1652+
assert_on_unhandled_exception(vcpu);
16521653

16531654
return rc;
16541655
}

0 commit comments

Comments
 (0)