linux_old1/tools/bpf/bpftool
Toke Høiland-Jørgensen 5b79bcdf03 bpftool: Don't crash on missing jited insns or ksyms
When the kptr_restrict sysctl is set, the kernel can fail to return
jited_ksyms or jited_prog_insns, but still have positive values in
nr_jited_ksyms and jited_prog_len. This causes bpftool to crash when
trying to dump the program because it only checks the len fields not
the actual pointers to the instructions and ksyms.

Fix this by adding the missing checks.

Fixes: 71bb428fe2 ("tools: bpf: add bpftool")
Fixes: f84192ee00 ("tools: bpftool: resolve calls without using imm field")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191210181412.151226-1-toke@redhat.com
2019-12-11 13:57:26 +01:00
..
Documentation tools: bpftool: add "bpftool map freeze" subcommand 2019-08-21 21:17:27 +02:00
bash-completion tools: bpftool: add "bpftool map freeze" subcommand 2019-08-21 21:17:27 +02:00
.gitignore tools: bpf: account for generated feature/ and libbpf/ directories 2019-08-31 00:38:16 +02:00
Makefile tools: bpftool: do not link twice against libbpf.a in Makefile 2019-08-31 00:38:16 +02:00
btf.c tools, bpftool: Fix warning on ignored return value for 'read' 2019-11-24 16:58:44 -08:00
btf_dumper.c tools: bpftool: fix format strings and arguments for jsonw_printf() 2019-08-15 22:06:46 -07:00
cfg.c tools: bpftool: teach cfg code about JMP32 2019-01-26 13:33:01 -08:00
cfg.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00
cgroup.c tools: bpftool: compile with $(EXTRA_WARNINGS) 2019-08-14 22:57:36 +02:00
common.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2019-09-06 16:49:17 +02:00
feature.c tools: bpftool: fix reading from /proc/config.gz 2019-08-12 11:07:16 +02:00
jit_disasm.c tools: bpftool: Fix json dump crash on powerpc 2019-07-05 23:50:38 +02:00
json_writer.c tools: bpftool: move "__printf()" attributes to header file 2019-08-15 22:06:46 -07:00
json_writer.h tools: bpftool: move "__printf()" attributes to header file 2019-08-15 22:06:46 -07:00
main.c bpftool: Fix bpftool build by switching to bpf_object__open_file() 2019-10-07 18:44:28 -07:00
main.h bpftool: Fix bpftool build by switching to bpf_object__open_file() 2019-10-07 18:44:28 -07:00
map.c tools: bpftool: add "bpftool map freeze" subcommand 2019-08-21 21:17:27 +02:00
map_perf_ring.c tools: bpftool: fix arguments for p_err() in do_event_pipe() 2019-08-15 22:06:46 -07:00
net.c tools: bpftool: fix format string for p_err() in query_flow_dissector() 2019-08-15 22:06:46 -07:00
netlink_dumper.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
netlink_dumper.h tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
perf.c tools: bpftool: compile with $(EXTRA_WARNINGS) 2019-08-14 22:57:36 +02:00
prog.c bpftool: Don't crash on missing jited insns or ksyms 2019-12-11 13:57:26 +01:00
tracelog.c tools: bpftool: add an option to prevent auto-mount of bpffs, tracefs 2018-12-18 14:47:17 +01:00
xlated_dumper.c bpftool: Don't crash on missing jited insns or ksyms 2019-12-11 13:57:26 +01:00
xlated_dumper.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00