[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200914132920.59183-1-christian.koenig@amd.com>
Date: Mon, 14 Sep 2020 15:29:18 +0200
From: "Christian König"
<ckoenig.leichtzumerken@...il.com>
To: akpm@...ux-foundation.org
Cc: sumit.semwal@...aro.org, linux-media@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linaro-mm-sig@...ts.linaro.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Changing vma->vm_file in dma_buf_mmap()
Hi Andrew,
I'm the new DMA-buf maintainer and Daniel and others came up with patches extending the use of the dma_buf_mmap() function.
Now this function is doing something a bit odd by changing the vma->vm_file while installing a VMA in the mmap() system call
The background here is that DMA-buf allows device drivers to export buffer which are then imported into another device driver. The mmap() handler of the importing device driver then find that the pgoff belongs to the exporting device and so redirects the mmap() call there.
In other words user space calls mmap() on one file descriptor, but get a different one mapped into your virtual address space.
My question is now: Is that legal or can you think of something which breaks here?
If it's not legal we should probably block any new users of the dma_buf_mmap() function and consider what should happen with the two existing ones.
If that is legal I would like to document this by adding a new vma_set_file() function which does the necessary reference count dance.
Thanks in advance,
Christian.
Powered by blists - more mailing lists