]> www.infradead.org Git - users/dwmw2/linux.git/commit
bpf: Allow kind_flag for BTF type and decl tags
authorIhor Solodrai <ihor.solodrai@linux.dev>
Thu, 30 Jan 2025 20:12:38 +0000 (12:12 -0800)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 6 Feb 2025 00:17:59 +0000 (16:17 -0800)
commit53ee0d66d7a6c00358eaffd003cb2c11f6b26e98
tree5cd1d8d1e96b6b44260f6cd3d29ee07430d0d470
parent6c2d2a05a762ba3618afa5ed94c11fd8ebc5e435
bpf: Allow kind_flag for BTF type and decl tags

BTF type tags and decl tags now may have info->kflag set to 1,
changing the semantics of the tag.

Change BTF verification to permit BTF that makes use of this feature:
  * remove kflag check in btf_decl_tag_check_meta(), as both values
    are valid
  * allow kflag to be set for BTF_KIND_TYPE_TAG type in
    btf_ref_type_check_meta()

Make sure kind_flag is NOT set when checking for specific BTF tags,
such as "kptr", "user" etc.

Modify a selftest checking for kflag in decl_tag accordingly.

Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/bpf/20250130201239.1429648-6-ihor.solodrai@linux.dev
kernel/bpf/btf.c
tools/testing/selftests/bpf/prog_tests/btf.c