[PATCH v2 0/2] mm/process_vm_access: pidfd and nowait support for process_vm_readv/writev

Alban Crequy
2026-04-08T14:54:58Z

This adds two flags to process_vm_readv/writev:

- PROCESS_VM_PIDFD: refer to the remote process via PID file descriptor
instead of PID.
- PROCESS_VM_NOWAIT: do not block on IO if the memory access causes a
page fault.

v1: https://lore.kernel.org/lkml/20251118132348.2415603-1-alban.crequy@gmail.com/

Changes since v1:
- Expand commit message with use-case motivation (David Hildenbrand)
- Use unsigned long consistently for pvm_flags parameter (David Hildenbrand)
- Add PROCESS_VM_SUPPORTED_FLAGS kernel-internal define (David Hildenbrand)
- Keep (1UL << N) in UAPI header: BIT() is defined in vdso/bits.h
which is not exported to userspace, so UAPI headers using BIT() would
break when included from userspace programs (David Hildenbrand)
- Add selftests (new patch 2/2)

Alban Crequy (2):
mm/process_vm_access: pidfd and nowait support for
process_vm_readv/writev
selftests/mm: add tests for process_vm_readv flags

MAINTAINERS | 1 +
include/uapi/linux/process_vm.h | 9 +
mm/process_vm_access.c | 24 +-
tools/testing/selftests/mm/Makefile | 1 +
tools/testing/selftests/mm/process_vm_readv.c | 368 ++++++++++++++++++
5 files changed, 397 insertions(+), 6 deletions(-)
create mode 100644 include/uapi/linux/process_vm.h
create mode 100644 tools/testing/selftests/mm/process_vm_readv.c

--
2.45.0