[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzYxHsB3D-HT7H1zZsSDEjz_cU7FpfgFnVVzbe5qA4=dYg@mail.gmail.com>
Date: Mon, 23 May 2022 16:23:59 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Stanislav Fomichev <sdf@...gle.com>
Cc: Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>
Subject: Re: [PATCH bpf-next v7 05/11] bpf: implement BPF_PROG_QUERY for BPF_LSM_CGROUP
On Wed, May 18, 2022 at 3:55 PM Stanislav Fomichev <sdf@...gle.com> wrote:
>
> We have two options:
> 1. Treat all BPF_LSM_CGROUP the same, regardless of attach_btf_id
> 2. Treat BPF_LSM_CGROUP+attach_btf_id as a separate hook point
>
> I was doing (2) in the original patch, but switching to (1) here:
>
> * bpf_prog_query returns all attached BPF_LSM_CGROUP programs
> regardless of attach_btf_id
> * attach_btf_id is exported via bpf_prog_info
>
> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> ---
> include/uapi/linux/bpf.h | 5 ++
> kernel/bpf/cgroup.c | 103 +++++++++++++++++++++++++++------------
> kernel/bpf/syscall.c | 4 +-
> 3 files changed, 81 insertions(+), 31 deletions(-)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index b9d2d6de63a7..432fc5f49567 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -1432,6 +1432,7 @@ union bpf_attr {
> __u32 attach_flags;
> __aligned_u64 prog_ids;
> __u32 prog_cnt;
> + __aligned_u64 prog_attach_flags; /* output: per-program attach_flags */
> } query;
>
> struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */
> @@ -5911,6 +5912,10 @@ struct bpf_prog_info {
> __u64 run_cnt;
> __u64 recursion_misses;
> __u32 verified_insns;
> + /* BTF ID of the function to attach to within BTF object identified
> + * by btf_id.
> + */
> + __u32 attach_btf_func_id;
it's called attach_btf_id for PROG_LOAD command, keep it consistently
named (and a bit more generic)?
> } __attribute__((aligned(8)));
>
> struct bpf_map_info {
[...]
Powered by blists - more mailing lists