On Tue, Nov 09, 2021 at 09:19:40PM -0800, Yonghong Song 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() > etc. to read the data. +#define __tag1 __attribute__((btf_type_tag("tag1"))) +#define __tag2 __attribute__((btf_type_tag("tag2"))) + +struct btf_type_tag_test { + int __tag1 * __tag1 __tag2 *p; +} g; Can we build the kernel with the latest clang and get __user in BTF ?