]> git.baikalelectronics.ru Git - kernel.git/commit
bpftool: Don't crash on missing jited insns or ksyms
authorToke Høiland-Jørgensen <toke@redhat.com>
Tue, 10 Dec 2019 18:14:12 +0000 (19:14 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 11 Dec 2019 12:57:26 +0000 (13:57 +0100)
commitb9aeb728959ab3b9567cf2e6b7e1dc0b232b5cd7
treec3f21a9c363b0b320e5678a69b1d847d733cb5ef
parent73b661445daa20cac16e428ca459479b4b3bff24
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: 9ffb478b4d49 ("tools: bpf: add bpftool")
Fixes: 090ac1d4a70b ("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
tools/bpf/bpftool/prog.c
tools/bpf/bpftool/xlated_dumper.c