mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bixuan Cui <cuibixuan@vivo.com>
To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	martin.lau@linux.dev, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
	haoluo@google.com, jolsa@kernel.org, cuibixuan@vivo.com
Subject: [PATCH bpf-next] libbpf: Ignore the modules that failed to load BTF object
Date: Tue, 28 Oct 2025 06:57:32 -0700	[thread overview]
Message-ID: <20251028135732.6489-1-cuibixuan@vivo.com> (raw)

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@vivo.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;
 		}

 		err = libbpf_ensure_mem((void **)&obj->btf_modules, &obj->btf_module_cap,
--
2.39.0


             reply	other threads:[~2025-10-28 13:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28 13:57 Bixuan Cui [this message]
2025-10-28 18:05 ` Andrii Nakryiko
2025-10-28 18:21   ` Alan Maguire
2025-10-29  1:35     ` Bixuan Cui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251028135732.6489-1-cuibixuan@vivo.com \
    --to=cuibixuan@vivo.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®