summaryrefslogtreecommitdiffstats
path: root/tools/bpf
diff options
context:
space:
mode:
authorLouis Peens <louis.peens@netronome.com>2020-07-08 13:08:27 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2020-07-09 00:32:00 +0200
commit625eb8e85e913273cd9441329a82b4e3496b30cd (patch)
tree7a18403cd56909f3ae0f516acae4e000f57e0ce9 /tools/bpf
parent5cfd607b49db2b7c05fccc2915a528d97bc8f17d (diff)
downloadlinux-625eb8e85e913273cd9441329a82b4e3496b30cd.tar.gz
linux-625eb8e85e913273cd9441329a82b4e3496b30cd.tar.bz2
linux-625eb8e85e913273cd9441329a82b4e3496b30cd.zip
bpf: Fix another bpftool segfault without skeleton code enabled
emit_obj_refs_json needs to added the same as with emit_obj_refs_plain to prevent segfaults, similar to Commit "8ae4121bd89e bpf: Fix bpftool without skeleton code enabled"). See the error below: # ./bpftool -p prog { "error": "bpftool built without PID iterator support" },[{ "id": 2, "type": "cgroup_skb", "tag": "7be49e3934a125ba", "gpl_compatible": true, "loaded_at": 1594052789, "uid": 0, "bytes_xlated": 296, "jited": true, "bytes_jited": 203, "bytes_memlock": 4096, "map_ids": [2,3 Segmentation fault (core dumped) The same happens for ./bpftool -p map, as well as ./bpftool -j prog/map. Fixes: d53dee3fe013 ("tools/bpftool: Show info for processes holding BPF map/prog/link/btf FDs") Signed-off-by: Louis Peens <louis.peens@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Simon Horman <simon.horman@netronome.com> Reviewed-by: Quentin Monnet <quentin@isovalent.com> Link: https://lore.kernel.org/bpf/20200708110827.7673-1-louis.peens@netronome.com
Diffstat (limited to 'tools/bpf')
-rw-r--r--tools/bpf/bpftool/pids.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/pids.c b/tools/bpf/bpftool/pids.c
index 7d5416667c85..c0d23ce4a6f4 100644
--- a/tools/bpf/bpftool/pids.c
+++ b/tools/bpf/bpftool/pids.c
@@ -20,6 +20,7 @@ int build_obj_refs_table(struct obj_refs_table *table, enum bpf_obj_type type)
}
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) {}
+void emit_obj_refs_json(struct obj_refs_table *table, __u32 id, json_writer_t *json_writer) {}
#else /* BPFTOOL_WITHOUT_SKELETONS */