Linux Media Controller development
 help / color / mirror / Atom feed
* [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

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