Skip to content

Commit

Permalink
bpf: Fix bpftool without skeleton code enabled
Browse files Browse the repository at this point in the history
Fix segfault from bpftool by adding emit_obj_refs_plain when skeleton
code is disabled.

Tested by deleting BUILD_BPF_SKELS in Makefile. We found this doing
backports for Cilium when a testing image pulled in latest bpf-next
bpftool, but kept using an older clang-7.

  # ./bpftool prog show
  Error: bpftool built without PID iterator support
  3: cgroup_skb  tag 7be49e3934a125ba  gpl
          loaded_at 2020-07-01T08:01:29-0700  uid 0
  Segmentation fault

Fixes: d53dee3 ("tools/bpftool: Show info for processes holding BPF map/prog/link/btf FDs")
Reported-by: Joe Stringer <[email protected]>
Signed-off-by: John Fastabend <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/bpf/159375071997.14984.17404504293832961401.stgit@john-XPS-13-9370
  • Loading branch information
jrfastab authored and borkmann committed Jul 3, 2020
1 parent 046cc3d commit 8ae4121
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tools/bpf/bpftool/pids.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ int build_obj_refs_table(struct obj_refs_table *table, enum bpf_obj_type type)
return -ENOTSUP;
}
void delete_obj_refs_table(struct obj_refs_table *table) {}
void emit_obj_refs_plain(struct obj_refs_table *table, __u32 id, const char *prefix) {}

#else /* BPFTOOL_WITHOUT_SKELETONS */

Expand Down

0 comments on commit 8ae4121

Please sign in to comment.