selftests/udmabuf: Open /dev/udmabuf O_RDONLY
PATCH v3 1/1 selftests/udmabuf: 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.
Signed-off-by T.J. Mercier <[email protected]>
Reviewed-by Bobby Eshleman <[email protected]>
--- tools/testing/selftests/drivers/dma-buf/udmabuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/drivers/dma-buf/udmabuf.c +1 -1
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])ksft_print_header ();ksft_set_plan (7 ); - devfd =open ("/dev/udmabuf" ,O_RDWR ); + devfd =open ("/dev/udmabuf" ,O_RDONLY );if (devfd <0 ) { ksft_print_msg( "%s: [skip,no-udmabuf: Unable to access DMA buffer device file]\n",
base-commit: 20f01a5565ce79923b75a2ac8e8ef2a1d7adf517
Signature · 1 line
2.55.0.229.g6434b31f56-goog