[Devel] [PATCH hci-8.1 v2 0/2] vfio, KVM: kvm reference leak and debugfs clash on live update

Konstantin Khorenko khorenko at virtuozzo.com
Thu Nov 5 15:54:22 MSK 2026


I won't apply this version, please send v3 with the changes below.

On Thu, 5 Nov 2026 14:17:31 +0200, Andrey Drobyshev wrote:
> Patch 1 takes that reference only for the drivers that read
> device->kvm.  Patch 2 removes the debugfs directory when the VM's fd
> is released.

Patch 1 is right in the code now, thanks. What to change for v3:

1. Patch 1, code comment and commit message: the three drivers read
   device->kvm in open_device(), not after it, and vfio_ap reads it
   only there. Say also that device->kvm stays NULL for a driver
   without the flag, not only that no reference is taken.

2. Patch 1, commit message: say how you checked that nvidia-vgpu-vfio
   does not read device->kvm.

3. Patch 2: test patch 1 alone. With it, nothing should keep the old
   VM alive across cpr-exec on your setup, so the duplicate directory
   should be gone too. If it is, drop patch 2. If it is not, the
   message has to name what still holds the VM, since "VFIO keeps a
   reference" is no longer true for your driver.

4. Patch 2, code, if it stays: rename the directory with
   debugfs_change_name() to a name that cannot clash, instead of
   removing it. Removing it opens a use-after-free on powerpc. A
   rename also keeps STATS_PATH and the vcpu stats, so the "Two things
   change" paragraph goes away.

5. Both patches: drop "Assisted-by: LLM" from the commits, since
   2026-10-22 it goes only into the cover letter, as one line before
   the sign-off.

6. Cover letter: single space after a period (three places), the
   Assisted-by line, and the result of item 3. Say what "no
   mismatches" compares, or drop it.

Details are in the replies to the patches.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list