Re: [PATCH v2 08/22] vfio: Enforce preserved devices are retrieved via LIVEUPDATE_SESSION_RETRIEVE_FD

David Matlack
2026-02-26T23:27:53Z

On 2026-02-26 04:15 PM, Alex Williamson wrote:
> On Thu, 29 Jan 2026 21:24:55 +0000 David Matlack <dmatlack@google.com> wrote:

> > + /*
> > + * This device was preserved across a Live Update. Accessing it via
> > + * VFIO_GROUP_GET_DEVICE_FD is not allowed.
> > + */
> > + if (vfio_liveupdate_incoming_is_preserved(device)) {
> > + vfio_device_put_registration(device);
> > + return -EBUSY;
>
> Is this an EPERM issue then?

I was thinking EBUSY in the sense that the device is only temporarily
inaccesible through this interface due it being in a preserved state as
part of a Live Update. Once the preserved device file is retreived and
closed, the device can be accessed again through
VFIO_GROUP_GET_DEVICE_FD.

EPERM might lead to confusion that there is a filesystem permission
issue?

> > +#ifdef CONFIG_LIVEUPDATE
> > +static inline bool vfio_liveupdate_incoming_is_preserved(struct vfio_device *device)
> > +{
> > + struct device *d = device->dev;
> > +
> > + if (dev_is_pci(d))
> > + return to_pci_dev(d)->liveupdate_incoming;
> > +
> > + return false;
> > +}
> > +#else
> > +static inline bool vfio_liveupdate_incoming_is_preserved(struct vfio_device *device)
> > +{
> > + return false;
> > +}
> > +#endif
>
> Why does this need to be in the public header versus
> drivers/vfio/vfio.h?

No good reason. I'll make it private.