On Tue, Sep 14, 2021 at 3:30 PM Yonghong Song <yhs@xxxxxx> wrote: > > LLVM14 added support for a new C attribute ([1]) > __attribute__((btf_tag("arbitrary_str"))) > This attribute will be emitted to dwarf ([2]) and pahole > will convert it to BTF. Or for bpf target, this > attribute will be emitted to BTF directly ([3], [4]). > The attribute is intended to provide additional > information for > - struct/union type or struct/union member > - static/global variables > - static/global function or function parameter. > > For linux kernel, the btf_tag can be applied > in various places to specify user pointer, > function pre- or post- condition, function > allow/deny in certain context, etc. Such information > will be encoded in vmlinux BTF and can be used > by verifier. > > The btf_tag can also be applied to bpf programs > to help global verifiable functions, e.g., > specifying preconditions, etc. > > This patch added basic parsing and checking support > in kernel for new BTF_KIND_TAG kind. > > [1] https://reviews.llvm.org/D106614 > [2] https://reviews.llvm.org/D106621 > [3] https://reviews.llvm.org/D106622 > [4] https://reviews.llvm.org/D109560 > > Signed-off-by: Yonghong Song <yhs@xxxxxx> > --- LGTM. Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > include/uapi/linux/btf.h | 14 +++- > kernel/bpf/btf.c | 128 +++++++++++++++++++++++++++++++++ > tools/include/uapi/linux/btf.h | 14 +++- > 3 files changed, 154 insertions(+), 2 deletions(-) > [...]