Skip to content

Commit abd6f59

Browse files
libbpf: Improve debug message when the base BTF cannot be found
JIRA: https://issues.redhat.com/browse/RHEL-78201 commit 9a17db5 Author: Ben Olson <matthew.olson@intel.com> Date: Tue Nov 26 14:08:45 2024 -0600 libbpf: Improve debug message when the base BTF cannot be found When running `bpftool` on a kernel module installed in `/lib/modules...`, this error is encountered if the user does not specify `--base-btf` to point to a valid base BTF (e.g. usually in `/sys/kernel/btf/vmlinux`). However, looking at the debug output to determine the cause of the error simply says `Invalid BTF string section`, which does not point to the actual source of the error. This just improves that debug message to tell users what happened. Signed-off-by: Ben Olson <matthew.olson@intel.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/Z0YqzQ5lNz7obQG7@bolson-desk Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
1 parent c546218 commit abd6f59

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/btf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static int btf_parse_str_sec(struct btf *btf)
283283
return -EINVAL;
284284
}
285285
if (!btf->base_btf && start[0]) {
286-
pr_debug("Invalid BTF string section\n");
286+
pr_debug("Malformed BTF string section, did you forget to provide base BTF?\n");
287287
return -EINVAL;
288288
}
289289
return 0;

0 commit comments

Comments
 (0)