On 11/11/21 10:27 AM, Andrii Nakryiko wrote:
On Tue, Nov 9, 2021 at 9:19 PM Yonghong Song <yhs@xxxxxx> wrote:
LLVM patches ([1] for clang, [2] and [3] for BPF backend)
added support for btf_type_tag attributes. This patch
added support for the kernel.
The main motivation for btf_type_tag is to bring kernel
annotations __user, __rcu etc. to btf. With such information
available in btf, bpf verifier can detect mis-usages
and reject the program. For example, for __user tagged pointer,
developers can then use proper helper like bpf_probe_read_kernel()
probably meant to write bpf_probe_read_user()?
Oh, yes, a typo. should be bpf_probe_read_user().
LGTM, otherwise.
Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
etc. to read the data.
BTF_KIND_TYPE_TAG may also useful for other tracing
facility where instead of to require user to specify
kernel/user address type, the kernel can detect it
by itself with btf.
[1] https://reviews.llvm.org/D111199
[2] https://reviews.llvm.org/D113222
[3] https://reviews.llvm.org/D113496
Signed-off-by: Yonghong Song <yhs@xxxxxx>
---
include/uapi/linux/btf.h | 3 ++-
kernel/bpf/btf.c | 14 +++++++++++++-
tools/include/uapi/linux/btf.h | 3 ++-
3 files changed, 17 insertions(+), 3 deletions(-)
[...]