Re: [PATCH] kselftests: dmabuf-heaps: Open heap device files O_RDONLY
From: Christian König
Date: Mon Nov 09 2026 - 06:11:12 EST
On 11/6/26 19:42, T.J. Mercier wrote:
> On Wed, Aug 12, 2026 at 9:06 AM T.J. Mercier <tjmercier@xxxxxxxxxx> wrote:
>>
>> On Wed, Aug 12, 2026 at 8:02 AM Sumit Semwal <sumit.semwal@xxxxxxxxxx> wrote:
>>>
>>> Hello T J,
>>>
>>> On Wed, 12 Aug 2026 at 02:11, T.J. Mercier <tjmercier@xxxxxxxxxx> wrote:
>>>>
>>>> Write permissions on the /dev/dma_heap/* device files are not required
>>>> to issue ioctls and allocate dmabufs. Applications should be opening
>>>> these file as O_RDONLY. The BPF dmabuf_iter selftest already does
>>>> this. [1]
>>>>
>>>> Users are pointing to these selftests as examples of how use dmabuf,
>>>> and encountering permission errors on systems where write permissions
>>>> are not available on /dev/dma_heap/*. Apply the principle of least
>>>> privilege to selftests which open dmabuf heaps by removing the write
>>>> access mode and using O_RDONLY for the open() instead.
>>>
>>> Thanks for the patch.
>>>>
>>>> The same is true for the vgem test using /dev/dri/card.
>>>>
>>>> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/bpf/prog_tests/dmabuf_iter.c?h=v7.1#n49
>>>>
>>>> Signed-off-by: T.J. Mercier <tjmercier@xxxxxxxxxx>
>>> Acked-by: Sumit Semwal <sumit.semwal@xxxxxxxxxx>
>>
>> Thanks for the quick revieews John, Christian, and Sumit!
>
> Hi, I don't think this has made it into any tree. Can this get picked up please?
Pushed to drm-misc-next.
T.J. I think it would be a good idea if you apply for commit rights to drm-misc.
The tooling used for that repo is a bit special, but considering how much Android uses DMA-buf it is probably a good idea that you are able to help pushing code upstream.
Regards,
Christian.