From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: torvalds@linux-foundation.org, davem@davemloft.net,
daniel@iogearbox.net, ebiederm@xmission.com,
netdev@vger.kernel.org, bpf@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH bpf-next 0/3] bpf: Populate bpffs with map and prog iterators
Date: Fri, 3 Jul 2020 17:07:45 -0700 [thread overview]
Message-ID: <20200704000745.hv4fyewbm4f5ttao@ast-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <878sg0etik.fsf@toke.dk>
On Fri, Jul 03, 2020 at 01:18:43PM +0200, Toke Høiland-Jørgensen wrote:
> > The user mode driver will load BPF Type Formats, create BPF maps, populate BPF
> > maps, load two BPF programs, attach them to BPF iterators, and finally send two
> > bpf_link IDs back to the kernel.
> > The kernel will pin two bpf_links into newly mounted bpffs instance under
> > names "progs" and "maps". These two files become human readable.
> >
> > $ cat /sys/fs/bpf/progs
> > id name pages attached
> > 11 dump_bpf_map 1 bpf_iter_bpf_map
> > 12 dump_bpf_prog 1 bpf_iter_bpf_prog
> > 27 test_pkt_access 1
> > 32 test_main 1 test_pkt_access test_pkt_access
> > 33 test_subprog1 1 test_pkt_access_subprog1 test_pkt_access
> > 34 test_subprog2 1 test_pkt_access_subprog2 test_pkt_access
> > 35 test_subprog3 1 test_pkt_access_subprog3 test_pkt_access
> > 36 new_get_skb_len 1 get_skb_len test_pkt_access
> > 37 new_get_skb_ifi 1 get_skb_ifindex test_pkt_access
> > 38 new_get_constan 1 get_constant test_pkt_access
>
> Do the iterators respect namespace boundaries? Or will I see all
> programs/maps on the host if I cat the file inside a container?
why are you asking? I'm pretty sure you know that bpf infra isn't namespaced yet.
> > Few interesting observations:
> > - though bpffs comes with two human readble files "progs" and "maps" they
> > can be removed. 'rm -f /sys/fs/bpf/progs' will remove bpf_link and kernel
> > will automatically unload corresponding BPF progs, maps, BTFs.
>
> Is there any way to get the files back if one does this by mistake
> (other than re-mounting the bpffs)?
Same as user A pining their prog/map/link in bpffs and user B removing it.
next prev parent reply other threads:[~2020-07-04 0:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-02 20:03 [PATCH bpf-next 0/3] bpf: Populate bpffs with map and prog iterators Alexei Starovoitov
2020-07-02 20:03 ` [PATCH bpf-next 1/3] bpf: Factor out bpf_link_get_by_id() helper Alexei Starovoitov
2020-07-06 23:08 ` Andrii Nakryiko
2020-07-02 20:03 ` [PATCH bpf-next 2/3] bpf: Add BPF program and map iterators as built-in BPF programs Alexei Starovoitov
2020-07-08 21:55 ` Andrii Nakryiko
2020-07-02 20:03 ` [PATCH bpf-next 3/3] bpf: Add kernel module with user mode driver that populates bpffs Alexei Starovoitov
2020-07-02 22:14 ` kernel test robot
2020-07-02 22:53 ` kernel test robot
2020-07-03 1:05 ` Linus Torvalds
2020-07-03 2:35 ` Alexei Starovoitov
2020-07-03 3:34 ` Linus Torvalds
2020-07-04 0:06 ` Alexei Starovoitov
2020-07-09 3:15 ` Andrii Nakryiko
2020-07-10 6:31 ` Yonghong Song
2020-07-03 11:18 ` [PATCH bpf-next 0/3] bpf: Populate bpffs with map and prog iterators Toke Høiland-Jørgensen
2020-07-04 0:07 ` Alexei Starovoitov [this message]
2020-07-04 10:48 ` Toke Høiland-Jørgensen
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=20200704000745.hv4fyewbm4f5ttao@ast-mbp.dhcp.thefacebook.com \
--to=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=toke@redhat.com \
--cc=torvalds@linux-foundation.org \
/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).