]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/ublk: add read-only buffer registration test
authorMing Lei <ming.lei@redhat.com>
Tue, 31 Mar 2026 15:32:01 +0000 (23:32 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 7 Apr 2026 13:42:39 +0000 (07:42 -0600)
commitaffb5f67d73c1e0bd412e7807a55691502b5679e
tree8b497eee061d0b448715d6de7bb220cfc08332e9
parent12075992c62ee330b2c531fa066b19be21698115
selftests/ublk: add read-only buffer registration test

Add --rdonly_shmem_buf option to kublk that registers shared memory
buffers with UBLK_SHMEM_BUF_READ_ONLY (read-only pinning without
FOLL_WRITE) and mmaps with PROT_READ only.

Add test_shmemzc_04.sh which exercises the new flag with a null target,
hugetlbfs buffer, and write workload. Write I/O works because the
server only reads from the shared buffer — the data flows from client
to kernel to the shared pages, and the server reads them out.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://patch.msgid.link/20260331153207.3635125-11-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
tools/testing/selftests/ublk/Makefile
tools/testing/selftests/ublk/kublk.c
tools/testing/selftests/ublk/kublk.h
tools/testing/selftests/ublk/test_shmemzc_04.sh [new file with mode: 0755]