Loading kernel/bpf/btf.c +20 −1 Original line number Diff line number Diff line Loading @@ -1286,8 +1286,27 @@ static struct btf_kind_operations ptr_ops = { .seq_show = btf_ptr_seq_show, }; static s32 btf_fwd_check_meta(struct btf_verifier_env *env, const struct btf_type *t, u32 meta_left) { if (btf_type_vlen(t)) { btf_verifier_log_type(env, t, "vlen != 0"); return -EINVAL; } if (t->type) { btf_verifier_log_type(env, t, "type != 0"); return -EINVAL; } btf_verifier_log_type(env, t, NULL); return 0; } static struct btf_kind_operations fwd_ops = { .check_meta = btf_ref_type_check_meta, .check_meta = btf_fwd_check_meta, .resolve = btf_df_resolve, .check_member = btf_df_check_member, .log_details = btf_ref_type_log, Loading tools/testing/selftests/bpf/test_btf.c +22 −0 Original line number Diff line number Diff line Loading @@ -1242,6 +1242,28 @@ static struct btf_raw_test raw_tests[] = { .err_str = "Invalid btf_info", }, { .descr = "fwd test. t->type != 0\"", .raw_types = { /* int */ /* [1] */ BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* fwd type */ /* [2] */ BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_FWD, 0, 0), 1), BTF_END_RAW, }, .str_sec = "", .str_sec_size = sizeof(""), .map_type = BPF_MAP_TYPE_ARRAY, .map_name = "fwd_test_map", .key_size = sizeof(int), .value_size = sizeof(int), .key_type_id = 1, .value_type_id = 1, .max_entries = 4, .btf_load_err = true, .err_str = "type != 0", }, }; /* struct btf_raw_test raw_tests[] */ static const char *get_next_str(const char *start, const char *end) Loading Loading
kernel/bpf/btf.c +20 −1 Original line number Diff line number Diff line Loading @@ -1286,8 +1286,27 @@ static struct btf_kind_operations ptr_ops = { .seq_show = btf_ptr_seq_show, }; static s32 btf_fwd_check_meta(struct btf_verifier_env *env, const struct btf_type *t, u32 meta_left) { if (btf_type_vlen(t)) { btf_verifier_log_type(env, t, "vlen != 0"); return -EINVAL; } if (t->type) { btf_verifier_log_type(env, t, "type != 0"); return -EINVAL; } btf_verifier_log_type(env, t, NULL); return 0; } static struct btf_kind_operations fwd_ops = { .check_meta = btf_ref_type_check_meta, .check_meta = btf_fwd_check_meta, .resolve = btf_df_resolve, .check_member = btf_df_check_member, .log_details = btf_ref_type_log, Loading
tools/testing/selftests/bpf/test_btf.c +22 −0 Original line number Diff line number Diff line Loading @@ -1242,6 +1242,28 @@ static struct btf_raw_test raw_tests[] = { .err_str = "Invalid btf_info", }, { .descr = "fwd test. t->type != 0\"", .raw_types = { /* int */ /* [1] */ BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4), /* fwd type */ /* [2] */ BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_FWD, 0, 0), 1), BTF_END_RAW, }, .str_sec = "", .str_sec_size = sizeof(""), .map_type = BPF_MAP_TYPE_ARRAY, .map_name = "fwd_test_map", .key_size = sizeof(int), .value_size = sizeof(int), .key_type_id = 1, .value_type_id = 1, .max_entries = 4, .btf_load_err = true, .err_str = "type != 0", }, }; /* struct btf_raw_test raw_tests[] */ static const char *get_next_str(const char *start, const char *end) Loading