From: Mario Limonciello <mario.limonciello@amd.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
sumit.semwal@linaro.org, linux-media@vger.kernel.org,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
lizhi.hou@amd.com, Max.Zhen@amd.com, airlied@gmail.com,
karol.wachowski@linux.intel.com
Cc: "Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH] dma-buf: explicitely forbid exposing pages from get_user_pages()
Date: Tue, 30 Jun 2026 08:42:11 -0500 [thread overview]
Message-ID: <c790dbb3-72ab-4d86-ad63-bffce5809bee@amd.com> (raw)
In-Reply-To: <20260630080112.1117341-1-christian.koenig@amd.com>
On 6/30/26 03:01, Christian König wrote:
> We recently had another incident where two drivers put pages they got from
> get_user_pages() into a DMA-buf and cause quite a number of problems.
>
> Explicitely document that this is not something exporters can do.
I think it would be a good idea to send this up to
https://github.com/masoncl/review-prompts/blob/main/kernel/subsystem/drm.md
as well.
That's what Sashiko uses and it will help flag this in case it happens
in future.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/dma-buf/dma-buf.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 71f37544a5c6..aa5af4f439c2 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -685,6 +685,14 @@ static struct file *dma_buf_getfile(size_t size, int flags)
> *
> * For the detailed semantics exporters are expected to implement see
> * &dma_buf_ops.
> + *
> + * It is explicitely forbidden for exporters to expose buffers they don't "own"
> + * as DMA-buf. This includes pages acquired by get_user_pages() or other import
> + * mechanism. Not following this rule can create numerous security problems.
> + *
> + * It is also strongly discouraged to expose the same backing store through
> + * multiple DMA-bufs at the same time. This eventually creates aliasing and
> + * cache coherency problems which are extremely hard to debug and fix.
> */
>
> /**
next prev parent reply other threads:[~2026-06-30 13:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 8:01 [PATCH] dma-buf: explicitely forbid exposing pages from get_user_pages() Christian König
2026-06-30 8:03 ` sashiko-bot
2026-06-30 13:42 ` Mario Limonciello [this message]
2026-07-07 9:06 ` Christian König
2026-07-07 15:41 ` Max Zhen
2026-07-07 16:54 ` Lizhi Hou
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=c790dbb3-72ab-4d86-ad63-bffce5809bee@amd.com \
--to=mario.limonciello@amd.com \
--cc=Max.Zhen@amd.com \
--cc=airlied@gmail.com \
--cc=christian.koenig@amd.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karol.wachowski@linux.intel.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-media@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=sumit.semwal@linaro.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 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.