Skip to content

Commit e291950

Browse files
yonghong-songNobody
authored and
Nobody
committed
bpf: add BTF_KIND_DECL_TAG typedef support
The llvm patches ([1], [2]) added support to attach btf_decl_tag attributes to typedef declarations. This patch added support in kernel. [1] https://reviews.llvm.org/D110127 [2] https://reviews.llvm.org/D112259 Signed-off-by: Yonghong Song <[email protected]>
1 parent cf141f7 commit e291950

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/bpf/btf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ static bool btf_type_is_decl_tag(const struct btf_type *t)
468468
static bool btf_type_is_decl_tag_target(const struct btf_type *t)
469469
{
470470
return btf_type_is_func(t) || btf_type_is_struct(t) ||
471-
btf_type_is_var(t);
471+
btf_type_is_var(t) || btf_type_is_typedef(t);
472472
}
473473

474474
u32 btf_nr_types(const struct btf *btf)
@@ -3885,7 +3885,7 @@ static int btf_decl_tag_resolve(struct btf_verifier_env *env,
38853885

38863886
component_idx = btf_type_decl_tag(t)->component_idx;
38873887
if (component_idx != -1) {
3888-
if (btf_type_is_var(next_type)) {
3888+
if (btf_type_is_var(next_type) || btf_type_is_typedef(next_type)) {
38893889
btf_verifier_log_type(env, v->t, "Invalid component_idx");
38903890
return -EINVAL;
38913891
}

0 commit comments

Comments
 (0)