[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200904161313.29535-2-quentin@isovalent.com>
Date: Fri, 4 Sep 2020 17:13:12 +0100
From: Quentin Monnet <quentin@...valent.com>
To: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org,
Martynas Pumputis <m@...bda.lt>,
Quentin Monnet <quentin@...valent.com>
Subject: [PATCH bpf-next 1/2] tools: bpftool: dump outer maps content
Although user space can lookup and dump the content of an outer map
(hash-of-maps or array-of-maps), bpftool does not allow to do so.
It seems that the only reason for that is historical. Lookups for outer
maps was added in commit 14dc6f04f49d ("bpf: Add syscall lookup support
for fd array and htab"), and although the relevant code in bpftool had
not been merged yet, I suspect it had already been written with the
assumption that user space could not read outer maps.
Let's remove the restriction, dump for outer maps works with no further
change.
Reported-by: Martynas Pumputis <m@...bda.lt>
Signed-off-by: Quentin Monnet <quentin@...valent.com>
---
tools/bpf/bpftool/map.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index bc0071228f88..cb3a75eb5531 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -739,10 +739,6 @@ static int dump_map_elem(int fd, void *key, void *value,
/* lookup error handling */
lookup_errno = errno;
- if (map_is_map_of_maps(map_info->type) ||
- map_is_map_of_progs(map_info->type))
- return 0;
-
if (json_output) {
jsonw_start_object(json_wtr);
jsonw_name(json_wtr, "key");
--
2.25.1
Powered by blists - more mailing lists