]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm: Add copy_remote_vm_str() for readng C strings from remote VM
authorJordan Rome <linux@jordanrome.com>
Thu, 13 Feb 2025 15:21:23 +0000 (07:21 -0800)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 20 Feb 2025 00:57:16 +0000 (16:57 -0800)
commitf0b79944e6f41b1a242b128fb2702378eb48fbd2
tree1e1edf60a093c9a1fc424a24f64ad1610936dea7
parentac13c5087299e7690848302cd3073a37c7222364
mm: Add copy_remote_vm_str() for readng C strings from remote VM

Similar to `access_process_vm()` but specific to strings. Also chunks
reads by page and utilizes `strscpy()` for handling null termination.

The primary motivation for this change is to copy strings from
a non-current task/process in BPF. There is already a helper
`bpf_copy_from_user_task()`, which uses `access_process_vm()` but one to
handle strings would be very helpful.

Signed-off-by: Jordan Rome <linux@jordanrome.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
Link: https://lore.kernel.org/bpf/20250213152125.1837400-1-linux@jordanrome.com
include/linux/mm.h
mm/memory.c
mm/nommu.c