Re: [PATCH bpf-next v9 07/10] btf: Verify BTF Sorting
From: Eduard Zingerman
Date: Tue Dec 16 2025 - 19:41:54 EST
On Tue, 2025-12-09 at 11:21 +0800, Donglin Peng wrote:
[...]
> > @@ -5889,6 +5943,8 @@ static struct btf *btf_parse(const union bpf_attr *attr, bpfptr_t uattr, u32 uat
> > if (err)
> > goto errout;
> >
> > + btf_check_sorted(btf);
>
> I think there is no need to check sorting here, because the BTF in this
> code path is generated by the compiler. We only need to cover the cases
> of vmlinux and kernel module BTF.
Idk, we can teach compiler to sort BTF types one day.
Having this call shouldn't incur too much overhead, right?
> > +
> > struct_meta_tab = btf_parse_struct_metas(&env->log, btf);
> > if (IS_ERR(struct_meta_tab)) {
> > err = PTR_ERR(struct_meta_tab);
[...]