From: Daniel Vetter <daniel@ffwll.ch>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Daniel Vetter <daniel@ffwll.ch>,
"Xiong, Jianxin" <jianxin.xiong@intel.com>,
Leon Romanovsky <leon@kernel.org>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
Doug Ledford <dledford@redhat.com>,
"Vetter, Daniel" <daniel.vetter@intel.com>,
Christian Koenig <christian.koenig@amd.com>
Subject: Re: [PATCH v8 1/5] RDMA/umem: Support importing dma-buf as user memory region
Date: Tue, 10 Nov 2020 15:44:07 +0100 [thread overview]
Message-ID: <20201110144407.GM401619@phenom.ffwll.local> (raw)
In-Reply-To: <20201110142757.GM244516@ziepe.ca>
On Tue, Nov 10, 2020 at 10:27:57AM -0400, Jason Gunthorpe wrote:
> On Tue, Nov 10, 2020 at 03:14:45PM +0100, Daniel Vetter wrote:
> > On Fri, Nov 06, 2020 at 12:39:53PM -0400, Jason Gunthorpe wrote:
> > > On Fri, Nov 06, 2020 at 04:34:07PM +0000, Xiong, Jianxin wrote:
> > >
> > > > > The user could specify a length that is beyond the dma buf, can
> > > > > the dma buf length be checked during get?
> > > >
> > > > In order to check the length, the buffer needs to be mapped. That can be done.
> > >
> > > Do DMA bufs even have definitate immutable lengths? Going to be a
> > > probelm if they can shrink
> >
> > Yup. Unfortunately that's not document in the structures themselves,
> > there's just some random comments sprinkled all over that dma-buf size is
> > invariant, e.g. see the @mmap kerneldoc in dma_buf_ops:
> >
> > https://dri.freedesktop.org/docs/drm/driver-api/dma-buf.html?highlight=dma_buf_ops#c.dma_buf_ops
> >
> > "Because dma-buf buffers have invariant size over their lifetime, ..."
> >
> > Jianxin, can you pls do a kerneldoc patch which updates the comment for
> > dma_buf.size and dma_buf_export_info.size?
>
> So we can check the size without doing an attachment?
Yeah size should be invariant over the lifetime of the dma_buf (it's also
needed for dma_buf_vmap kernel cpu access and dma_buf_mmap userspace mmap
forwarding). No lock or attachment needed. But like I said, would be good
to have the kerneldoc patch to make this clear.
The history here is that the X shm extension suffered badly from
resizeable storage object exploits of the X server, this is why both
dma-buf (and also drm_gem_buffer_object before that generalization) and
memfd are size sealed.
-Daniel
> That means the flow should be put back to how it was a series or two
> ago where the SGL is only attached during page fault with the entire
> programming sequence under the resv lock
>
> Jason
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
next prev parent reply other threads:[~2020-11-10 14:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 22:48 [PATCH v8 0/5] RDMA: Add dma-buf support Jianxin Xiong
2020-11-05 22:48 ` [PATCH v8 1/5] RDMA/umem: Support importing dma-buf as user memory region Jianxin Xiong
2020-11-06 0:08 ` Jason Gunthorpe
2020-11-06 16:34 ` Xiong, Jianxin
2020-11-06 16:39 ` Jason Gunthorpe
2020-11-06 17:01 ` Xiong, Jianxin
2020-11-10 14:14 ` Daniel Vetter
2020-11-10 14:27 ` Jason Gunthorpe
2020-11-10 14:44 ` Daniel Vetter [this message]
2020-11-10 17:23 ` Xiong, Jianxin
2020-11-05 22:48 ` [PATCH v8 2/5] RDMA/core: Add device method for registering dma-buf based " Jianxin Xiong
2020-11-05 22:48 ` [PATCH v8 3/5] RDMA/uverbs: Add uverbs command for dma-buf based MR registration Jianxin Xiong
2020-11-06 0:13 ` Jason Gunthorpe
2020-11-06 16:20 ` Xiong, Jianxin
2020-11-06 16:37 ` Jason Gunthorpe
2020-11-05 22:48 ` [PATCH v8 4/5] RDMA/mlx5: Support dma-buf based userspace memory region Jianxin Xiong
2020-11-06 0:25 ` Jason Gunthorpe
2020-11-06 1:11 ` Xiong, Jianxin
2020-11-06 12:48 ` Jason Gunthorpe
2020-11-06 16:10 ` Xiong, Jianxin
2020-11-05 22:48 ` [PATCH v8 5/5] dma-buf: Reject attach request from importers that use dma_virt_ops Jianxin Xiong
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=20201110144407.GM401619@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=christian.koenig@amd.com \
--cc=daniel.vetter@intel.com \
--cc=dledford@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jgg@ziepe.ca \
--cc=jianxin.xiong@intel.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox