uaccess: Add non-pagefault user-space write function
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 1 Nov 2019 23:17:56 +0000 (00:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Jan 2020 18:48:40 +0000 (19:48 +0100)
commite5194ee4bf62f4187c64e8c5755d53066c8851f5
tree3b20be6d29877bfda11b8f430b13702e9bd4a3f2
parent8efa2de5fb5bf881e176d0af0f863902b1b2189b
uaccess: Add non-pagefault user-space write function

commit 1d1585ca0f48fe7ed95c3571f3e4a82b2b5045dc upstream.

Commit 3d7081822f7f ("uaccess: Add non-pagefault user-space read functions")
missed to add probe write function, therefore factor out a probe_write_common()
helper with most logic of probe_kernel_write() except setting KERNEL_DS, and
add a new probe_user_write() helper so it can be used from BPF side.

Again, on some archs, the user address space and kernel address space can
co-exist and be overlapping, so in such case, setting KERNEL_DS would mean
that the given address is treated as being in kernel address space.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Link: https://lore.kernel.org/bpf/9df2542e68141bfa3addde631441ee45503856a8.1572649915.git.daniel@iogearbox.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/uaccess.h
mm/maccess.c