Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1250407

Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs

From Hannes Frederic Sowa <hannes@stressinduktion.org>
Newsgroups linux.kernel
Subject Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs
Date 2015-10-19 09:40 +0200
Message-ID <qldd0-65B-15@gated-at.bofh.it> (permalink)
References (11 earlier) <qkyMz-5GA-41@gated-at.bofh.it> <qkNVh-2KP-61@gated-at.bofh.it> <qkXKW-mZ-9@gated-at.bofh.it> <qkZjH-2st-5@gated-at.bofh.it> <ql3dE-8hp-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

On Sun, Oct 18, 2015, at 22:59, Alexei Starovoitov wrote:
> On 10/18/15 9:49 AM, Daniel Borkmann wrote:
> > Okay, I have pushed some rough working proof of concept here:
> >
> > https://git.breakpoint.cc/cgit/dborkman/net-next.git/log/?h=ebpf-fds-final5
> >
> > So the idea eventually had to be slightly modified after giving this
> > further
> > thoughts and is the following:
> >
> > We have 3 commands (BPF_DEV_CREATE, BPF_DEV_DESTROY, BPF_DEV_CONNECT), and
> > related to that a bpf_attr extension with only a single __u32 fd member
> > in it.
> ...
> > The nice thing about it is that you can create/unlink as many as you
> > want, but
> > when you remove the real device from an application via
> > bpf_dev_destroy(fd),
> > then all links disappear with it. Just like in the case of a normal
> > device driver.
> 
> interesting idea!
> What happens if user app creates a dev via bpf_dev_create(), exits and
> then admin does rm of that dev ?
> Looks like map/prog will leak ?
> So the only proper way to delete such cdevs is via bpf_dev_destroy ?

The mknod is not the holder but rather the kobject which should be
represented in sysfs will be. So you can still get the map major:minor
by looking up the /dev file in the correspdonding sysfs directory or I
think we should provide a 'unbind' file, which will drop the kobject if
the user writes a '1' to it.

> 
> > On device creation, the kernel will return the minor number via bpf(2),
> > so you
> > can access the file easily, f.e. /dev/bpf/bpf_map<minor> resp.
> > /dev/bpf/bpf_prog<minor>,
> > and then move on with mknod(2) or symlink(2) from there if wished.
> 
> what if admin mknod in that dir with some arbitrary minor ?

Basically, -EIO. :)

> mknod will succeed, but it won't hold anything?

That is right now true for basically all mknod operations, which udev
creates.

> looks like bpf_dev_connect will handle it gracefully.
> So these cdevs should only be created and destroyed via bpf syscall
> and only sensible operations on them is open() to get fd and pass
> to bpf_dev_connect and symlink. Anything else admin should be
> careful not to do. Right?

Besides maybe some statistics and other stuff in sysfs directory, no,
that is all.

Bye,
Hannes

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-16 03:20 +0200
  Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-10-16 12:30 +0200
    Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-16 15:40 +0200
      Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-10-16 18:40 +0200
        Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-16 19:30 +0200
          Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-16 19:40 +0200
    Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-16 18:20 +0200
      Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-10-16 18:50 +0200
        Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Thomas Graf <tgraf@suug.ch> - 2015-10-16 19:40 +0200
        Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-16 19:40 +0200
  Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-10-16 19:30 +0200
    Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-16 19:50 +0200
      Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-16 20:00 +0200
        Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs ebiederm@xmission.com (Eric W. Biederman) - 2015-10-16 21:00 +0200
          Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-16 21:30 +0200
            Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-16 22:00 +0200
            Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs ebiederm@xmission.com (Eric W. Biederman) - 2015-10-16 22:10 +0200
              Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-16 23:00 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs ebiederm@xmission.com (Eric W. Biederman) - 2015-10-17 02:00 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-17 04:50 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-17 14:30 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-18 06:40 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-18 17:10 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-18 18:50 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-18 23:00 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-10-19 09:40 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-19 12:00 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-19 16:30 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-19 18:30 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-19 19:40 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-19 20:20 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-10-19 20:50 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-19 21:40 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-10-19 22:10 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-19 22:50 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-20 00:20 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-20 02:40 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-20 10:50 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-20 20:00 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs ebiederm@xmission.com (Eric W. Biederman) - 2015-10-20 21:10 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-21 17:20 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Thomas Graf <tgraf@suug.ch> - 2015-10-21 20:40 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-22 00:50 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-22 15:30 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs ebiederm@xmission.com (Eric W. Biederman) - 2015-10-22 21:50 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Daniel Borkmann <daniel@iogearbox.net> - 2015-10-23 15:50 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-10-20 11:50 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-10-20 01:10 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-20 03:10 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-10-20 12:10 +0200
                Re: [PATCH net-next 3/4] bpf: add support for persistent maps/progs Alexei Starovoitov <ast@plumgrid.com> - 2015-10-20 20:50 +0200

csiph-web