]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: selftests: Close VM's binary stats FD when releasing VM
authorSean Christopherson <seanjc@google.com>
Sat, 11 Jan 2025 00:50:42 +0000 (16:50 -0800)
committerSean Christopherson <seanjc@google.com>
Wed, 12 Feb 2025 17:02:42 +0000 (09:02 -0800)
commitf7f232a01f3d26a5bd67a4309ea54640f625dbe5
treef3025476d28b144bd95162d6807754707aaa9fe0
parentfd546aba1967bb05ddb569272f56abb75f604bd7
KVM: selftests: Close VM's binary stats FD when releasing VM

Close/free a VM's binary stats cache when the VM is released, not when the
VM is fully freed.  When a VM is re-created, e.g. for state save/restore
tests, the stats FD and descriptor points at the old, defunct VM.  The FD
is still valid, in that the underlying stats file won't be freed until the
FD is closed, but reading stats will always pull information from the old
VM.

Note, this is a benign bug in the current code base as none of the tests
that recreate VMs use binary stats.

Fixes: 83f6e109f562 ("KVM: selftests: Cache binary stats metadata for duration of test")
Link: https://lore.kernel.org/r/20250111005049.1247555-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/lib/kvm_util.c