linux-stable/tools/bpf/bpftool
Andrii Nakryiko 932c605581 tools/bpftool: Fix PID fetching with a lot of results
In case of having so many PID results that they don't fit into a singe page
(4096) bytes, bpftool will erroneously conclude that it got corrupted data due
to 4096 not being a multiple of struct pid_iter_entry, so the last entry will
be partially truncated. Fix this by sizing the buffer to fit exactly N entries
with no truncation in the middle of record.

Fixes: d53dee3fe0 ("tools/bpftool: Show info for processes holding BPF map/prog/link/btf FDs")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20201204232002.3589803-1-andrii@kernel.org
2020-12-08 16:45:20 +01:00
..
bash-completion tools: bpftool: Add "inner_map" to "bpftool map create" outer maps 2020-09-10 17:29:21 -07:00
Documentation bpftool: Fix build failure 2020-09-14 18:47:57 -07:00
skeleton tools, bpftool: Remove two unused variables. 2020-10-29 15:23:18 +01:00
.gitignore tools/bpftool: Generalize BPF skeleton support and generate vmlinux.h 2020-06-22 17:01:48 -07:00
btf.c bpftool: Fix error return value in build_btf_type_table 2020-11-24 23:19:18 +01:00
btf_dumper.c tools/bpftool: Fix compilation warnings in 32-bit mode 2020-08-13 16:45:41 -07:00
cfg.c tools, bpftool: Poison and replace kernel integer typedefs 2020-05-11 21:20:46 +02:00
cfg.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00
cgroup.c tools, bpftool: Clean subcommand help messages 2020-06-01 14:38:18 -07:00
common.c bpftool: Use only nftw for file tree parsing 2020-07-21 23:42:56 +02:00
feature.c tools, bpftool: Avoid array index warnings. 2020-10-29 15:22:57 +01:00
gen.c tools/bpftool: Remove libbpf_internal.h usage in bpftool 2020-08-18 18:38:25 -07:00
iter.c tools/bpf: Support new uapi for map element bpf iterator 2020-08-06 16:39:14 -07:00
jit_disasm.c tools/bpf/bpftool: Remove duplicate headers 2020-04-26 08:40:01 -07:00
json_writer.c bpftool: Support dumping metadata 2020-09-15 18:28:27 -07:00
json_writer.h bpftool: Support dumping metadata 2020-09-15 18:28:27 -07:00
link.c bpftool: Implement link_query for bpf iterators 2020-08-21 14:01:39 -07:00
main.c tools: bpftool: Print optional built-in features along with version 2020-09-10 11:16:46 -07:00
main.h tools/bpftool: Fix compilation warnings in 32-bit mode 2020-08-13 16:45:41 -07:00
Makefile Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-10-05 18:40:01 -07:00
map.c tools: bpftool: Add "inner_map" to "bpftool map create" outer maps 2020-09-10 17:29:21 -07:00
map_perf_ring.c tools, bpftool: Poison and replace kernel integer typedefs 2020-05-11 21:20:46 +02:00
net.c tools, bpftool: Add missing close before bpftool net attach exit 2020-11-13 15:59:13 +01:00
netlink_dumper.c bpftool: Use consistent include paths for libbpf 2020-01-20 16:37:45 -08:00
netlink_dumper.h tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
perf.c tools, bpftool: Clean subcommand help messages 2020-06-01 14:38:18 -07:00
pids.c tools/bpftool: Fix PID fetching with a lot of results 2020-12-08 16:45:20 +01:00
prog.c tools/bpftool: Fix attaching flow dissector 2020-11-05 18:20:41 -08:00
struct_ops.c tools, bpftool: Clean subcommand help messages 2020-06-01 14:38:18 -07: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: Use consistent include paths for libbpf 2020-01-20 16:37:45 -08:00
xlated_dumper.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00