netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: "Maciej Żenczykowski" <zenczykowski@gmail.com>
Cc: "Maciej Żenczykowski" <maze@google.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Linux Network Development Mailing List" <netdev@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"BPF Mailing List" <bpf@vger.kernel.org>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH bpf-next] bpf: print a little more info about maps via cat /sys/fs/bpf/pinned_name
Date: Mon, 23 May 2022 12:32:22 -0700	[thread overview]
Message-ID: <CAADnVQJcDvyeQ3y=uVDj-7JfqtxE+nJk+d5oVQrBhhQpicYk6A@mail.gmail.com> (raw)
In-Reply-To: <20220521075736.1225397-1-zenczykowski@gmail.com>

On Sat, May 21, 2022 at 12:57 AM Maciej Żenczykowski
<zenczykowski@gmail.com> wrote:
>
> From: Maciej Żenczykowski <maze@google.com>
>
> While this information can be fetched via bpftool,
> the cli tool itself isn't always available on more limited systems.
>
> From the information printed particularly the 'id' is useful since
> when combined with /proc/pid/fd/X and /proc/pid/fdinfo/X it allows
> tracking down which bpf maps a process has open (which can be
> useful for tracking down fd leaks).
>
> Signed-off-by: Maciej Żenczykowski <maze@google.com>
> ---
>  kernel/bpf/inode.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
> index 4f841e16779e..784266e258fe 100644
> --- a/kernel/bpf/inode.c
> +++ b/kernel/bpf/inode.c
> @@ -257,6 +257,9 @@ static int map_seq_show(struct seq_file *m, void *v)
>         if (unlikely(v == SEQ_START_TOKEN)) {
>                 seq_puts(m, "# WARNING!! The output is for debug purpose only\n");
>                 seq_puts(m, "# WARNING!! The output format will change\n");
> +               seq_printf(m, "# type: %d, key_size: %d, value_size: %d, max_entries: %d, id: %d\n",
> +                          map->map_type, map->key_size, map->value_size, map->max_entries,
> +                          map->id);

Maybe use cat /sys/fs/bpf/maps.debug instead?
It prints map id.

  reply	other threads:[~2022-05-23 19:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-21  7:57 [PATCH bpf-next] bpf: print a little more info about maps via cat /sys/fs/bpf/pinned_name Maciej Żenczykowski
2022-05-23 19:32 ` Alexei Starovoitov [this message]
2022-05-23 20:14   ` Maciej Żenczykowski
2022-05-23 20:21     ` Alexei Starovoitov
2022-05-25 16:14       ` Maciej Żenczykowski
2022-05-25 16:32         ` Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAADnVQJcDvyeQ3y=uVDj-7JfqtxE+nJk+d5oVQrBhhQpicYk6A@mail.gmail.com' \
    --to=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=zenczykowski@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).