From: Quentin Monnet <quentin@isovalent.com>
To: Stanislav Fomichev <sdf@google.com>,
netdev@vger.kernel.org, bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org
Subject: Re: [PATCH bpf-next v9 09/10] bpftool: implement cgroup tree for BPF_LSM_CGROUP
Date: Mon, 13 Jun 2022 13:07:59 +0100 [thread overview]
Message-ID: <a0ebf40e-6c21-435e-0d87-bca7a2113241@isovalent.com> (raw)
In-Reply-To: <20220610165803.2860154-10-sdf@google.com>
2022-06-10 09:58 UTC-0700 ~ Stanislav Fomichev <sdf@google.com>
> $ bpftool --nomount prog loadall $KDIR/tools/testing/selftests/bpf/lsm_cgroup.o /sys/fs/bpf/x
> $ bpftool cgroup attach /sys/fs/cgroup lsm_cgroup pinned /sys/fs/bpf/x/socket_alloc
> $ bpftool cgroup attach /sys/fs/cgroup lsm_cgroup pinned /sys/fs/bpf/x/socket_bind
> $ bpftool cgroup attach /sys/fs/cgroup lsm_cgroup pinned /sys/fs/bpf/x/socket_clone
> $ bpftool cgroup attach /sys/fs/cgroup lsm_cgroup pinned /sys/fs/bpf/x/socket_post_create
> $ bpftool cgroup tree
> CgroupPath
> ID AttachType AttachFlags Name
> /sys/fs/cgroup
> 6 lsm_cgroup socket_post_create bpf_lsm_socket_post_create
> 8 lsm_cgroup socket_bind bpf_lsm_socket_bind
> 10 lsm_cgroup socket_alloc bpf_lsm_sk_alloc_security
> 11 lsm_cgroup socket_clone bpf_lsm_inet_csk_clone
>
> $ bpftool cgroup detach /sys/fs/cgroup lsm_cgroup pinned /sys/fs/bpf/x/socket_post_create
> $ bpftool cgroup tree
> CgroupPath
> ID AttachType AttachFlags Name
> /sys/fs/cgroup
> 8 lsm_cgroup socket_bind bpf_lsm_socket_bind
> 10 lsm_cgroup socket_alloc bpf_lsm_sk_alloc_security
> 11 lsm_cgroup socket_clone bpf_lsm_inet_csk_clone
>
> Signed-off-by: Stanislav Fomichev <sdf@google.com>
The changes for bpftool look good to me, thanks!
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
> ---
> tools/bpf/bpftool/cgroup.c | 80 +++++++++++++++++++++++++++-----------
> 1 file changed, 58 insertions(+), 22 deletions(-)
>
> diff --git a/tools/bpf/bpftool/cgroup.c b/tools/bpf/bpftool/cgroup.c
> index 42421fe47a58..6e55f583a62f 100644
> --- a/tools/bpf/bpftool/cgroup.c
> +++ b/tools/bpf/bpftool/cgroup.c
> @@ -542,5 +577,6 @@ static const struct cmd cmds[] = {
>
> int do_cgroup(int argc, char **argv)
> {
> + btf_vmlinux = libbpf_find_kernel_btf();
> return cmd_select(cmds, argc, argv, do_help);
> }
This is not required for all "bpftool cgroup" operations (attach/detach
don't need it I think), but should be inexpensive, right?
Quentin
next prev parent reply other threads:[~2022-06-13 15:02 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-10 16:57 [PATCH bpf-next v9 00/10] bpf: cgroup_sock lsm flavor Stanislav Fomichev
2022-06-10 16:57 ` [PATCH bpf-next v9 01/10] bpf: add bpf_func_t and trampoline helpers Stanislav Fomichev
2022-06-16 19:53 ` Martin KaFai Lau
2022-06-10 16:57 ` [PATCH bpf-next v9 02/10] bpf: convert cgroup_bpf.progs to hlist Stanislav Fomichev
2022-06-16 19:59 ` Martin KaFai Lau
2022-06-10 16:57 ` [PATCH bpf-next v9 03/10] bpf: per-cgroup lsm flavor Stanislav Fomichev
2022-06-16 22:25 ` Martin KaFai Lau
2022-06-17 18:28 ` Stanislav Fomichev
2022-06-17 22:25 ` Martin KaFai Lau
2022-06-10 16:57 ` [PATCH bpf-next v9 04/10] bpf: minimize number of allocated lsm slots per program Stanislav Fomichev
2022-06-11 16:53 ` kernel test robot
2022-06-17 0:43 ` Martin KaFai Lau
2022-06-17 18:28 ` Stanislav Fomichev
2022-06-17 22:27 ` Martin KaFai Lau
2022-06-10 16:57 ` [PATCH bpf-next v9 05/10] bpf: implement BPF_PROG_QUERY for BPF_LSM_CGROUP Stanislav Fomichev
2022-06-17 0:58 ` Martin KaFai Lau
2022-06-17 18:28 ` Stanislav Fomichev
2022-06-17 22:29 ` Martin KaFai Lau
2022-06-10 16:57 ` [PATCH bpf-next v9 06/10] bpf: expose bpf_{g,s}etsockopt to lsm cgroup Stanislav Fomichev
2022-06-17 5:42 ` Martin KaFai Lau
2022-06-17 18:28 ` Stanislav Fomichev
2022-06-17 23:07 ` Martin KaFai Lau
2022-06-21 17:51 ` Stanislav Fomichev
2022-06-10 16:58 ` [PATCH bpf-next v9 07/10] libbpf: add lsm_cgoup_sock type Stanislav Fomichev
2022-06-10 16:58 ` [PATCH bpf-next v9 08/10] libbpf: implement bpf_prog_query_opts Stanislav Fomichev
2022-06-10 16:58 ` [PATCH bpf-next v9 09/10] bpftool: implement cgroup tree for BPF_LSM_CGROUP Stanislav Fomichev
2022-06-13 12:07 ` Quentin Monnet [this message]
2022-06-13 15:53 ` Stanislav Fomichev
2022-06-17 5:58 ` Martin KaFai Lau
2022-06-17 18:28 ` Stanislav Fomichev
2022-06-10 16:58 ` [PATCH bpf-next v9 10/10] selftests/bpf: lsm_cgroup functional test Stanislav Fomichev
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=a0ebf40e-6c21-435e-0d87-bca7a2113241@isovalent.com \
--to=quentin@isovalent.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.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).