On Fri, Mar 28, 2025 at 1:54 PM Mykyta Yatsenko <mykyta.yatsenko5@xxxxxxxxx> wrote: > > On 28/03/2025 20:52, Andrii Nakryiko wrote: > > On Fri, Mar 28, 2025 at 12:16 PM Mykyta Yatsenko > > <mykyta.yatsenko5@xxxxxxxxx> wrote: > >> On 28/03/2025 17:14, Andrii Nakryiko wrote: > >>> On Wed, Mar 26, 2025 at 11:07 AM Mykyta Yatsenko > >>> <mykyta.yatsenko5@xxxxxxxxx> wrote: > >>>> From: Mykyta Yatsenko <yatsenko@xxxxxxxx> > >>>> > >>>> Introducing new libbpf API getters for BTF.ext func and line info, > >>>> namely: > >>>> bpf_program__func_info > >>>> bpf_program__func_info_cnt > >>>> bpf_program__func_info_rec_size > >>>> bpf_program__line_info > >>>> bpf_program__line_info_cnt > >>>> bpf_program__line_info_rec_size > >>>> > >>>> This change enables scenarios, when user needs to load bpf_program > >>>> directly using `bpf_prog_load`, instead of higher-level > >>>> `bpf_object__load`. Line and func info are required for checking BTF > >>>> info in verifier; verification may fail without these fields if, for > >>>> example, program calls `bpf_obj_new`. > >>>> > >>> Really, bpf_obj_new() needs func_info/line_info? Can you point where > >>> in the verifier we check this, curious why we do that. > >> Indirectly, yes: > >> in verifier.c function check_btf_info_early sets > >> `env->prog->aux->btf = btf;` > >> only if line_info_cnt or func_info_cnt are non zero. > >> and then there is a check that errors out: > >> `verbose(env, "bpf_obj_new/bpf_percpu_obj_new requires prog BTF\n");` > >> perhaps this can be improved as well, by setting aux->btf even if no > >> func info and line info > > lol, doesn't seem intentional (just in the early days prog BTF was > > only referenced and used with func_info/line_info, which isn't true > > anymore), we can probably swap the order and load and remember prog > > BTF regardless of func_info/line_info. Feel free to send a patch. > Sure, I'll do it. No. It's intentional. The prog must contain func and line info for good debuggability.