mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
libbpf: fix log level propagation for light skeleton loaders
bpftool's -d option is documented to enable bpf_trace_printk() messages from the generated syscall loader when used with -L as specified in commitd510296d33("bpftool: Use syscall/loader program in "prog load" and "gen skeleton" command.") However commitb59e4ce8bc("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 commite0e3ea888c("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:b59e4ce8bc("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> Link: https://lore.kernel.org/r/20260907170536.9996-1-mahe.tardy@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
a41c69c6ea
commit
e18e82ba9e
|
|
@ -9139,7 +9139,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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user