lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 17 Apr 2019 09:22:59 +0900
From:   Prashant Bhole <bhole_prashant_q7@....ntt.co.jp>
To:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>
Cc:     Prashant Bhole <bhole_prashant_q7@....ntt.co.jp>,
        Jakub Kicinski <jakub.kicinski@...ronome.com>,
        Quentin Monnet <quentin.monnet@...ronome.com>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        Andrii Nakryiko <andriin@...com>,
        prashantbhole.linux@...il.com, netdev@...r.kernel.org
Subject: [PATCH bpf-next v2 2/2] tools/bpftool: show btf_id in map listing

Let's print btf id of map similar to the way we are printing it
for programs.

Sample output:
user@...t# bpftool map -f
61: lpm_trie  flags 0x1
	key 20B  value 8B  max_entries 1  memlock 4096B
133: array  name test_btf_id  flags 0x0
	key 4B  value 4B  max_entries 4  memlock 4096B
	pinned /sys/fs/bpf/test100
	btf_id 174
170: array  name test_btf_id  flags 0x0
	key 4B  value 4B  max_entries 4  memlock 4096B
	btf_id 240

Signed-off-by: Prashant Bhole <bhole_prashant_q7@....ntt.co.jp>
Reviewed-by: Quentin Monnet <quentin.monnet@...ronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
Acked-by: Song Liu <songliubraving@...com>
---
v2: Add btf_id before pinned filename in show_map_close_json() as
    suggested by Quentin

 tools/bpf/bpftool/map.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index cda0f27fa895..17d379ef0edc 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -538,6 +538,9 @@ static int show_map_close_json(int fd, struct bpf_map_info *info)
 	}
 	close(fd);
 
+	if (info->btf_id)
+		jsonw_int_field(json_wtr, "btf_id", info->btf_id);
+
 	if (!hash_empty(map_table.table)) {
 		struct pinned_obj *obj;
 
@@ -613,6 +616,9 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
 		}
 	}
 
+	if (info->btf_id)
+		printf("\n\tbtf_id %d", info->btf_id);
+
 	printf("\n");
 	return 0;
 }
-- 
2.17.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ