[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4Bzbp2FYvTVz6SStj_p_ok+LLeXEAxcUiCkyWRf3wyjwi_Q@mail.gmail.com>
Date: Tue, 28 Oct 2025 11:05:14 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Bixuan Cui <cuibixuan@...o.com>
Cc: ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
martin.lau@...ux.dev, bpf@...r.kernel.org, linux-kernel@...r.kernel.org,
eddyz87@...il.com, song@...nel.org, yonghong.song@...ux.dev,
john.fastabend@...il.com, kpsingh@...nel.org, sdf@...ichev.me,
haoluo@...gle.com, jolsa@...nel.org
Subject: Re: [PATCH bpf-next] libbpf: Ignore the modules that failed to load
BTF object
On Tue, Oct 28, 2025 at 6:57 AM Bixuan Cui <cuibixuan@...o.com> wrote:
>
> Register kfunc in self-developed module but run error in other modules:
> libbpf: btf: type [164451]: referenced type [164446] is not FUNC_PROTO
> libbpf: failed to load module [syscon_reboot_mode]'s BTF object #2: -22
>
> It is usually skipping the error does not affect the search for the next module.
>
> Then ignoring the failed modules, load the bpf process:
> libbpf: btf: type [164451]: referenced type [164446] is not FUNC_PROTO
> libbpf: failed to load module [syscon_reboot_mode]'s BTF object #3: -22
> libbpf: extern (func ksym) 'bpf_kfunc': resolved to bpf_module [164442]
> ...
>
> Signed-off-by: Bixuan Cui <cuibixuan@...o.com>
> ---
> tools/lib/bpf/libbpf.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 711173acbcef..0fa0d89da068 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -5702,7 +5702,8 @@ static int load_module_btfs(struct bpf_object *obj)
> if (err) {
> pr_warn("failed to load module [%s]'s BTF object #%d: %d\n",
> name, id, err);
> - goto err_out;
> + close(fd);
> + continue;
> }
It's not an expected condition to have kernel module with corrupted
BTF, so I don't think we should be doing this.
pw-bot: cr
>
> err = libbpf_ensure_mem((void **)&obj->btf_modules, &obj->btf_module_cap,
> --
> 2.39.0
>
Powered by blists - more mailing lists