On Tue, May 12, 2026, Ackerley Tng wrote: > Fuad Tabba <[email protected]> writes: > > kvm_vm_release() closes vmp->fd and vmp->kvm_fd unconditionally, and > > kvm_vm_free() calls kvm_vm_release() at teardown. A test that calls > > kvm_vm_release() and then kvm_vm_free() without a > > vm_recreate_with_one_vcpu() in between double-closes both FDs. Since > > kvm_close() asserts on close() failure, the second close trips > > TEST_ASSERT and aborts the test, or, if the FD was recycled, silently > > closes an unrelated file. > > > > Never thought about this fd-recycling case, I think this change still > has value in avoiding the silent closing of some other file.
I have no objection to invalidating the fds, I just don't want to make kvm_vm_release() and kvm_vm_free() idempotent. The caller needs to not mess up.

