Re: [PATCH v4 8/8] vfio: Validate dma-buf revocation semantics

From: Leon Romanovsky

Date: Wed Jan 21 2026 - 10:28:08 EST


On Wed, Jan 21, 2026 at 09:47:12AM -0400, Jason Gunthorpe wrote:
> On Wed, Jan 21, 2026 at 02:59:16PM +0200, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@xxxxxxxxxx>
> >
> > Use the new dma_buf_attach_revocable() helper to restrict attachments to
> > importers that support mapping invalidation.
> >
> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
> > ---
> > drivers/vfio/pci/vfio_pci_dmabuf.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/vfio/pci/vfio_pci_dmabuf.c b/drivers/vfio/pci/vfio_pci_dmabuf.c
> > index 5fceefc40e27..85056a5a3faf 100644
> > --- a/drivers/vfio/pci/vfio_pci_dmabuf.c
> > +++ b/drivers/vfio/pci/vfio_pci_dmabuf.c
> > @@ -31,6 +31,9 @@ static int vfio_pci_dma_buf_attach(struct dma_buf *dmabuf,
> > if (priv->revoked)
> > return -ENODEV;
> >
> > + if (!dma_buf_attach_revocable(attachment))
> > + return -EOPNOTSUPP;
> > +
> > return 0;
> > }
>
> We need to push an urgent -rc fix to implement a pin function here
> that always fails. That was missed and it means things like rdma can
> import vfio when the intention was to block that. It would be bad for
> that uAPI mistake to reach a released kernel.

I don't see any urgency here. In the current kernel, the RDMA importer
prints a warning to indicate it was attached to the wrong exporter.
VFIO also invokes dma_buf_move_notify().

With this series, we finally remove that warning.

Let's focus on getting this series merged.

Thanks

>
> It's tricky that NULL pin ops means "I support pin" :|
>
> Jason