]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Add user-space variants of BPF_CORE_READ() family of macros
authorAndrii Nakryiko <andrii@kernel.org>
Fri, 18 Dec 2020 23:56:12 +0000 (15:56 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 8 Jan 2021 21:39:24 +0000 (13:39 -0800)
commita7d9902cded36f618ee2e563951aea403e4e01ba
tree95d6e3385c55e51fba29224e53d2c4f6cefbc3ab
parent02ead260cec44e68f5cb4fc38f26244bdfd0fac6
libbpf: Add user-space variants of BPF_CORE_READ() family of macros

Add BPF_CORE_READ_USER(), BPF_CORE_READ_USER_STR() and their _INTO()
variations to allow reading CO-RE-relocatable kernel data structures from the
user-space. One of such cases is reading input arguments of syscalls, while
reaping the benefits of CO-RE relocations w.r.t. handling 32/64 bit
conversions and handling missing/new fields in UAPI data structs.

Suggested-by: Gilad Reti <gilad.reti@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20201218235614.2284956-2-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/bpf_core_read.h