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]
Message-ID: <CAADnVQKWxzwAbZFAfOB2hxwOVP1mCfwpx30rcdRkCO-4DMxsZw@mail.gmail.com>
Date:   Mon, 23 May 2022 13:21:16 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Maciej Żenczykowski <zenczykowski@...il.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Linux Network Development Mailing List 
        <netdev@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        BPF Mailing List <bpf@...r.kernel.org>,
        "David S . Miller" <davem@...emloft.net>
Subject: Re: [PATCH bpf-next] bpf: print a little more info about maps via cat /sys/fs/bpf/pinned_name

On Mon, May 23, 2022 at 1:14 PM Maciej Żenczykowski
<zenczykowski@...il.com> wrote:
>
> On Mon, May 23, 2022 at 12:32 PM Alexei Starovoitov
> <alexei.starovoitov@...il.com> wrote:
> >
> > On Sat, May 21, 2022 at 12:57 AM Maciej Żenczykowski
> > <zenczykowski@...il.com> wrote:
> > >
> > > From: Maciej Żenczykowski <maze@...gle.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@...gle.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.
>
> Is this something that was very recently added?
> I'm not seeing it on my 5.16 machine with bpffs mounted at /sys/fs/bpf.

It was there since 2020.
Make sure you have CONFIG_BPF_PRELOAD.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ