selftests: drv-net: ncdevmem: Open /dev/udmabuf O_RDONLY
Subsystems (3)
PATCH 1/1 selftests: drv-net: ncdevmem: Open /dev/udmabuf O_RDONLY
Write permissions on the /dev/udmabuf device file are not required to issue ioctls and allocate udmabufs. Applications should be opening this file as O_RDONLY. The BPF dmabuf_iter selftest already does this. [1]
Users are pointing to these selftests as examples of how use udmabuf, and encountering permission errors on systems where write permissions are not available on /dev/udmabuf. Apply the principle of least privilege to selftests which use udmabuf by removing the write access mode from drivers/dma-buf/udmabuf.c and drivers/net/hw/ncdevmem.c.
--- tools/testing/selftests/drivers/net/hw/ncdevmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/drivers/net/hw/ncdevmem.c +1 -1
@@ -150,7 +150,7 @@ static struct memory_buffer *udmabuf_alloc(size_t size) ctx->size = size; - ctx->devfd =open ("/dev/udmabuf" ,O_RDWR ); + ctx->devfd =open ("/dev/udmabuf" ,O_RDONLY );if (ctx->devfd <0 ) {pr_err ("[skip,no-udmabuf: Unable to access DMA buffer device file]" ); goto err_free_ctx;
Signature · 1 line
2.55.0.229.g6434b31f56-goog
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Wed, 22 Jul 2026 13:54:42 -0700 you wrote:
Write permissions on the
/dev/udmabufdevice file are not required to issue ioctls and allocate udmabufs. Applications should be opening this file asO_RDONLY. The BPFdmabuf_iterselftest already does this. [1]Users are pointing to these selftests as examples of how use udmabuf, and encountering permission errors on systems where write permissions are not available on
/dev/udmabuf. Apply the principle of least privilege to selftests which use udmabuf by removing the write access mode fromdrivers/dma-buf/udmabuf.canddrivers/net/hw/ncdevmem.c.[...]
Here is the summary with links:
- [net-next] selftests: drv-net: ncdevmem: Open /dev/udmabuf O_RDONLY
https://git.kernel.org/netdev/net-next/c/be6f0d0bae22
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html