All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Alex Williamson <alex@shazbot.org>
Cc: "Matt Evans" <matt@ozlabs.org>,
	"Leon Romanovsky" <leon@kernel.org>,
	"Alex Mastro" <amastro@fb.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Logan Gunthorpe" <logang@deltatee.com>,
	"Kevin Tian" <kevin.tian@intel.com>,
	"Pranjal Shrivastava" <praan@google.com>,
	"Longfang Liu" <liulongfang@huawei.com>,
	"Mahmoud Adam" <mngyadam@amazon.de>,
	"David Matlack" <dmatlack@google.com>,
	"Björn Töpel" <bjorn@kernel.org>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Ankit Agrawal" <ankita@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Vivek Kasireddy" <vivek.kasireddy@intel.com>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	kvm@vger.kernel.org, linux-pci@vger.kernel.org,
	"Manish Honap" <mhonap@nvidia.com>
Subject: Re: [PATCH v7 0/9] vfio/pci: Add mmap() for DMABUFs
Date: Fri, 2 Oct 2026 11:51:08 -0300	[thread overview]
Message-ID: <20261002145108.GU1616761@nvidia.com> (raw)
In-Reply-To: <20261001153834.4a2528a2@shazbot.org>

On Thu, Oct 01, 2026 at 03:38:34PM -0600, Alex Williamson wrote:
> On Thu, 24 Sep 2026 16:21:43 +0100
> Matt Evans <matt@ozlabs.org> wrote:
> > Dear Reviewers,
> > ===============
> > 
> > Along the way several related issues came up that warrant more
> > eyes, and I'd be grateful for your input:
> > 
> > 1. If VFIO fd is opened O_RDONLY, it currently can't be mmap()ed
> >    (because PROT_WRITE is rejected in do_mmap(), and PROT_READ alone
> >    drops the VM_SHARED so VFIO's mmap rejects it).  BUT it seems we
> >    can export a DMABUF from it, and then pass the resulting fd around
> >    for P2P writes.
> > 
> >    I don't know if this is intentional/relied on/a known limitation,
> >    or a bug?
> 
> Seems like a bug.  In practice it's probably not very meaningful, the
> user can still potentially change the device power state and trigger a
> reset, but being able to source a writable dmabuf to a region on the
> device fd that isn't itself writable seems semantically wrong.

I'm shocked O_RDONLY even did *anything*, I never expected this.

IMHO with these kinds of cdev's we shouldn't do anything in response
to O_RDONLY. If the core code does something then fine, but I don't
think we should try to define a semantic what "Read only vfio" even
should mean.

> >    a) We could reject export w/ -EPERM unless the device fd's f_mode
> >       has O_RDWR, to reflect the RW abilities of P2P
> 
> This seems sufficient...

+1

Jason

      parent reply	other threads:[~2026-10-02 14:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 15:21 [PATCH v7 0/9] vfio/pci: Add mmap() for DMABUFs Matt Evans
2026-09-24 15:21 ` [PATCH v7 1/9] vfio/pci: Remove DMABUF export dependency on vdev->memory_lock Matt Evans
2026-09-24 15:37   ` sashiko-bot
2026-09-29 14:12     ` Matt Evans
2026-09-24 15:21 ` [PATCH v7 2/9] vfio/pci: Un-revoke DMABUFs in LOW_POWER_ENTRY_WITH_WAKEUP resume Matt Evans
2026-09-24 15:30   ` sashiko-bot
2026-09-24 15:21 ` [PATCH v7 3/9] dma-buf: Provide dma_buf_set_name() Matt Evans
2026-09-24 15:29   ` sashiko-bot
2026-09-25  8:39   ` Christian König
2026-09-29 11:43     ` Matt Evans
2026-09-24 15:21 ` [PATCH v7 4/9] vfio/pci: Add a helper to look up PFNs for DMABUFs Matt Evans
2026-09-24 15:35   ` sashiko-bot
2026-09-24 15:21 ` [PATCH v7 5/9] vfio/pci: Add a helper to create a DMABUF for a BAR-map VMA Matt Evans
2026-09-24 15:38   ` sashiko-bot
2026-09-24 15:21 ` [PATCH v7 6/9] vfio/pci: Convert BAR mmap() to use a DMABUF Matt Evans
2026-09-24 15:34   ` sashiko-bot
2026-09-28 17:59   ` Alex Mastro
2026-09-24 15:21 ` [PATCH v7 7/9] vfio/pci: Clean up BAR zap and revocation Matt Evans
2026-09-24 15:34   ` sashiko-bot
2026-09-24 15:21 ` [PATCH v7 8/9] vfio/pci: Support mmap() of a VFIO DMABUF Matt Evans
2026-09-24 15:36   ` sashiko-bot
2026-09-24 15:21 ` [PATCH v7 9/9] vfio/pci: Revoke a DMABUF on request from userspace Matt Evans
2026-09-24 15:35   ` sashiko-bot
2026-10-01 21:38 ` [PATCH v7 0/9] vfio/pci: Add mmap() for DMABUFs Alex Williamson
2026-10-02 14:04   ` Matt Evans
2026-10-02 14:51   ` Jason Gunthorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261002145108.GU1616761@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex@shazbot.org \
    --cc=amastro@fb.com \
    --cc=ankita@nvidia.com \
    --cc=apopple@nvidia.com \
    --cc=bhelgaas@google.com \
    --cc=bjorn@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=dmatlack@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=leon@kernel.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liulongfang@huawei.com \
    --cc=logang@deltatee.com \
    --cc=matt@ozlabs.org \
    --cc=mhonap@nvidia.com \
    --cc=mngyadam@amazon.de \
    --cc=praan@google.com \
    --cc=sumit.semwal@linaro.org \
    --cc=vivek.kasireddy@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.