summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2021-11-11 17:41:12 -0800
committerAlexei Starovoitov <ast@kernel.org>2021-11-11 17:41:12 -0800
commit9faaffbe85edcbdc54096f7f87baa3bc4842a7e2 (patch)
tree6a8410367d37d8b76451a9f35e2f0b9565f8c557 /include
parent2326ff8d5c6628e581c87f37a8f6db1db7dc00ee (diff)
parentd52f5c639dd8605d2563b77b190e278f615a2b8a (diff)
downloadcachepc-linux-9faaffbe85edcbdc54096f7f87baa3bc4842a7e2.tar.gz
cachepc-linux-9faaffbe85edcbdc54096f7f87baa3bc4842a7e2.zip
Merge branch 'Support BTF_KIND_TYPE_TAG for btf_type_tag attributes'
Yonghong Song says: ==================== 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. 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. Patch 1 added support in kernel, Patch 2 for libbpf and Patch 3 for bpftool. Patches 4-9 are for bpf selftests and Patch 10 updated docs/bpf/btf.rst file with new btf kind. [1] https://reviews.llvm.org/D111199 [2] https://reviews.llvm.org/D113222 [3] https://reviews.llvm.org/D113496 Changelogs: v2 -> v3: - rebase to resolve merge conflicts. v1 -> v2: - add more dedup tests. - remove build requirement for LLVM=1. - remove testing macro __has_attribute in bpf programs as it is always defined in recent clang compilers. ==================== Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/uapi/linux/btf.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/uapi/linux/btf.h b/include/uapi/linux/btf.h
index deb12f755f0f..b0d8fea1951d 100644
--- a/include/uapi/linux/btf.h
+++ b/include/uapi/linux/btf.h
@@ -43,7 +43,7 @@ struct btf_type {
* "size" tells the size of the type it is describing.
*
* "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT,
- * FUNC, FUNC_PROTO, VAR and DECL_TAG.
+ * FUNC, FUNC_PROTO, VAR, DECL_TAG and TYPE_TAG.
* "type" is a type_id referring to another type.
*/
union {
@@ -75,6 +75,7 @@ enum {
BTF_KIND_DATASEC = 15, /* Section */
BTF_KIND_FLOAT = 16, /* Floating point */
BTF_KIND_DECL_TAG = 17, /* Decl Tag */
+ BTF_KIND_TYPE_TAG = 18, /* Type Tag */
NR_BTF_KINDS,
BTF_KIND_MAX = NR_BTF_KINDS - 1,