* [PATCH bpf-next v2] libbpf: fix log level propagation for light skeleton loaders
@ 2026-09-07 17:05 Mahe Tardy
2026-09-14 4:50 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Mahe Tardy @ 2026-09-07 17:05 UTC (permalink / raw)
To: bpf
Cc: ast, daniel, andrii, eddyz87, memxor, martin.lau, song,
yonghong.song, jolsa, emil, ihor.solodrai, Mahe Tardy
bpftool's -d option is documented to enable bpf_trace_printk() messages
from the generated syscall loader when used with -L as specified in
commit d510296d331a ("bpftool: Use syscall/loader program in "prog load"
and "gen skeleton" command.")
However commit b59e4ce8bcaa ("bpftool: Switch bpf_object__load_xattr()
to bpf_object__load()") changed bpftool to use bpf_object__load() which
call the internal bpf_object_load with extra_log_level to 0 instead of
bpf_object__load_xattr with the user request log_level.
All the plumbing was still there to generate the bpf_trace_printk()
instructions from the generator but was now unreachable because
bpf_gen__init() was called with extra_log_level to 0, leaving
gen->log_level at 0.
This uses the obj->log_level field introduced in commit e0e3ea888c69
("libbpf: Allow passing user log setting through bpf_object_open_opts")
set from reading verifier_logs in do_skeleton(). This preserves both
object-level and explicit load-time logging settings.
Fixes: b59e4ce8bcaa ("bpftool: Switch bpf_object__load_xattr() to bpf_object__load()")
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
---
This v2 is just a rebase on bpf-next as there was a conflict after the
bpf tree was synched. Daniel suggested to push this to bpf-next as the
libbpf GH repo syncs only from there and added his ack.
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 c036e8a91ed8..395c4dcb54de 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -9144,7 +9144,8 @@ static int bpf_object_load(struct bpf_object *obj, int extra_log_level, const ch
* permit cross-endian creation of "light skeleton".
*/
if (obj->gen_loader) {
- bpf_gen__init(obj->gen_loader, extra_log_level, obj->nr_programs, obj->nr_maps);
+ bpf_gen__init(obj->gen_loader, obj->log_level | extra_log_level,
+ obj->nr_programs, obj->nr_maps);
} else if (!is_native_endianness(obj)) {
pr_warn("object '%s': loading non-native endianness is unsupported\n", obj->name);
return libbpf_err(-LIBBPF_ERRNO__ENDIAN);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next v2] libbpf: fix log level propagation for light skeleton loaders
2026-09-07 17:05 [PATCH bpf-next v2] libbpf: fix log level propagation for light skeleton loaders Mahe Tardy
@ 2026-09-14 4:50 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-14 4:50 UTC (permalink / raw)
To: Mahe Tardy
Cc: bpf, ast, daniel, andrii, eddyz87, memxor, martin.lau, song,
yonghong.song, jolsa, emil, ihor.solodrai
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Mon, 7 Sep 2026 17:05:36 +0000 you wrote:
> bpftool's -d option is documented to enable bpf_trace_printk() messages
> from the generated syscall loader when used with -L as specified in
> commit d510296d331a ("bpftool: Use syscall/loader program in "prog load"
> and "gen skeleton" command.")
>
> However commit b59e4ce8bcaa ("bpftool: Switch bpf_object__load_xattr()
> to bpf_object__load()") changed bpftool to use bpf_object__load() which
> call the internal bpf_object_load with extra_log_level to 0 instead of
> bpf_object__load_xattr with the user request log_level.
>
> [...]
Here is the summary with links:
- [bpf-next,v2] libbpf: fix log level propagation for light skeleton loaders
https://git.kernel.org/bpf/bpf-next/c/e18e82ba9ed5
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-14 4:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-07 17:05 [PATCH bpf-next v2] libbpf: fix log level propagation for light skeleton loaders Mahe Tardy
2026-09-14 4:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).