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 <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent fe85ce3 commit d6533c1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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)