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] [day] [month] [year] [list]
Message-ID: <20191218192930.GA30898@Omicron>
Date:   Wed, 18 Dec 2019 20:29:30 +0100
From:   Paul Chaignon <paul.chaignon@...nge.com>
To:     Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc:     bpf@...r.kernel.org, Quentin Monnet <quentin.monnet@...ronome.com>,
        paul.chaignon@...il.com, netdev@...r.kernel.org,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        Andrii Nakryiko <andriin@...com>
Subject: Re: [PATCH bpf-next v2 0/3] bpftool: match programs and maps by names

On Sun, Dec 15, 2019 at 09:40:05AM -0800, Alexei Starovoitov wrote:
> On Fri, Dec 13, 2019 at 08:09:52PM +0100, Paul Chaignon wrote:
> > When working with frequently modified BPF programs, both the ID and the
> > tag may change.  bpftool currently doesn't provide a "stable" way to match
> > such programs.  This patchset allows bpftool to match programs and maps by
> > name.
> > 
> > When given a tag that matches several programs, bpftool currently only
> > considers the first match.  The first patch changes that behavior to
> > either process all matching programs (for the show and dump commands) or
> > error out.  The second patch implements program lookup by name, with the
> > same behavior as for tags in case of ambiguity.  The last patch implements
> > map lookup by name.
> > 
> > Changelogs:
> >   Changes in v2:
> >     - Fix buffer overflow after realloc.
> >     - Add example output to commit message.
> >     - Properly close JSON arrays on errors.
> >     - Fix style errors (line breaks, for loops, exit labels, type for
> >       tagname).
> >     - Move do_show code for argc == 2 to do_show_subset functions.
> >     - Rebase.
> 
> Loogs good. Applied.
> 
> I found the exact match logic unintuitive though.
> Since 'prog show' can print multiple may be allow partial match on name?
> So 'bpftool p s name tracepoint__' would print all BCC-based programs
> that attach to tracepoints.
> It would be roughly equivalent to 'bpftool p s |grep tracepoint__',
> but grep captures single line.

I had a look at bcc and it actually removes these prefixes from the
program's name (except for kretprobes, but it looks like an oversight).

I still agree a partial match would be good to have since related
programs are more likely to share prefixes (e.g., func_entry and
func_exit).  Maybe matching on prefixes would be enough though?  I can't
think of use cases for a true partial match and the behavior might be a
bit unexpected for users...

Or we go all the way and implement support for * (e.g., tcp_* for all bcc
kprobes on tcp functions; *tcp* for all programs containing 'tcp').

> There is 'bpftool perf|grep tracepoint' as well, but since the tool
> matches on name it probably should match partial name too.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ