* [PATCH] dma-buf: explicitely forbid exposing pages from get_user_pages()
@ 2026-06-30 8:01 Christian König
2026-06-30 13:42 ` Mario Limonciello
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Christian König @ 2026-06-30 8:01 UTC (permalink / raw)
To: sumit.semwal, linux-media, dri-devel, linaro-mm-sig, lizhi.hou,
Max.Zhen, Mario.Limonciello, airlied, karol.wachowski
Cc: Christian König
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.
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.
*/
/**
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] dma-buf: explicitely forbid exposing pages from get_user_pages()
2026-06-30 8:01 [PATCH] dma-buf: explicitely forbid exposing pages from get_user_pages() Christian König
@ 2026-06-30 13:42 ` Mario Limonciello
2026-07-07 9:06 ` Christian König
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Mario Limonciello @ 2026-06-30 13:42 UTC (permalink / raw)
To: Christian König, sumit.semwal, linux-media, dri-devel,
linaro-mm-sig, lizhi.hou, Max.Zhen, airlied, karol.wachowski
Cc: Christian König
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.
> */
>
> /**
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dma-buf: explicitely forbid exposing pages from get_user_pages()
2026-06-30 8:01 [PATCH] dma-buf: explicitely forbid exposing pages from get_user_pages() Christian König
2026-06-30 13:42 ` Mario Limonciello
@ 2026-07-07 9:06 ` Christian König
2026-07-07 15:41 ` Max Zhen
2026-07-07 16:54 ` Lizhi Hou
3 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2026-07-07 9:06 UTC (permalink / raw)
To: Christian König, sumit.semwal, linux-media, dri-devel,
linaro-mm-sig, lizhi.hou, Max.Zhen, Mario.Limonciello, airlied,
karol.wachowski, Simona Vetter
Gentle ping.
Apart from the spelling mistakes Sashiko already pointed out, any comments on that?
Regards,
Christian.
On 6/30/26 10: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.
>
> 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.
> */
>
> /**
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dma-buf: explicitely forbid exposing pages from get_user_pages()
2026-06-30 8:01 [PATCH] dma-buf: explicitely forbid exposing pages from get_user_pages() Christian König
2026-06-30 13:42 ` Mario Limonciello
2026-07-07 9:06 ` Christian König
@ 2026-07-07 15:41 ` Max Zhen
2026-07-07 16:54 ` Lizhi Hou
3 siblings, 0 replies; 5+ messages in thread
From: Max Zhen @ 2026-07-07 15:41 UTC (permalink / raw)
To: Christian König, sumit.semwal, linux-media, dri-devel,
linaro-mm-sig, lizhi.hou, Mario.Limonciello, airlied,
karol.wachowski
Cc: Christian König
On 6/30/2026 Tue 01: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.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Max Zhen <max.zhen@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.
> */
>
> /**
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dma-buf: explicitely forbid exposing pages from get_user_pages()
2026-06-30 8:01 [PATCH] dma-buf: explicitely forbid exposing pages from get_user_pages() Christian König
` (2 preceding siblings ...)
2026-07-07 15:41 ` Max Zhen
@ 2026-07-07 16:54 ` Lizhi Hou
3 siblings, 0 replies; 5+ messages in thread
From: Lizhi Hou @ 2026-07-07 16:54 UTC (permalink / raw)
To: Christian König, sumit.semwal, linux-media, dri-devel,
linaro-mm-sig, Max.Zhen, Mario.Limonciello, airlied,
karol.wachowski
Cc: Christian König
On 6/30/26 01: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.
>
> 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.
> */
Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
>
> /**
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-07-07 16:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30 8:01 [PATCH] dma-buf: explicitely forbid exposing pages from get_user_pages() Christian König
2026-06-30 13:42 ` Mario Limonciello
2026-07-07 9:06 ` Christian König
2026-07-07 15:41 ` Max Zhen
2026-07-07 16:54 ` Lizhi Hou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox