Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: [PATCH bpf] libbpf: fix probe for BPF_PROG_TYPE_CGROUP_SOCKOPT
       [not found] <DB8P193MB0581FEB4CB90263430546C4C88E99@DB8P193MB0581.EURP193.PROD.OUTLOOK.COM>
@ 2021-07-27 21:17 ` Andrii Nakryiko
  2021-07-28 10:59   ` Robin Gögge
  0 siblings, 1 reply; 2+ messages in thread
From: Andrii Nakryiko @ 2021-07-27 21:17 UTC (permalink / raw)
  To: Robin Gögge
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Stanislav Fomichev, Networking, bpf, Quentin Monnet

On Tue, Jul 27, 2021 at 7:41 AM Robin Gögge <r.goegge@outlook.com> wrote:
>
> This patch fixes the probe for BPF_PROG_TYPE_CGROUP_SOCKOPT,
> so the probe reports accurate results when used by e.g.
> bpftool.
>
> Fixes: 4cdbfb59c44a ("libbpf: support sockopt hooks")
>
> Signed-off-by: Robin Gögge <r.goegge@outlook.com>
> Reviewed-by: Quentin Monnet <quentin@isovalent.com>
> ---

Looks good, I'll apply to bpf tree once this patch makes it into patchworks.

Meanwhile, looking at probe_load() seems like a bunch of other program
types are not handled properly as well. Would you mind checking that
as well and following up with more fixes for this? See also [0] for
this whole probing APIs situation.

  [0] https://github.com/libbpf/libbpf/issues/312

>  tools/lib/bpf/libbpf_probes.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c
> index ecaae2927ab8..cd8c703dde71 100644
> --- a/tools/lib/bpf/libbpf_probes.c
> +++ b/tools/lib/bpf/libbpf_probes.c
> @@ -75,6 +75,9 @@ probe_load(enum bpf_prog_type prog_type, const struct bpf_insn *insns,
>         case BPF_PROG_TYPE_CGROUP_SOCK_ADDR:
>                 xattr.expected_attach_type = BPF_CGROUP_INET4_CONNECT;
>                 break;
> +       case BPF_PROG_TYPE_CGROUP_SOCKOPT:
> +               xattr.expected_attach_type = BPF_CGROUP_GETSOCKOPT;
> +               break;
>         case BPF_PROG_TYPE_SK_LOOKUP:
>                 xattr.expected_attach_type = BPF_SK_LOOKUP;
>                 break;
> @@ -104,7 +107,6 @@ probe_load(enum bpf_prog_type prog_type, const struct bpf_insn *insns,
>         case BPF_PROG_TYPE_SK_REUSEPORT:
>         case BPF_PROG_TYPE_FLOW_DISSECTOR:
>         case BPF_PROG_TYPE_CGROUP_SYSCTL:
> -       case BPF_PROG_TYPE_CGROUP_SOCKOPT:
>         case BPF_PROG_TYPE_TRACING:
>         case BPF_PROG_TYPE_STRUCT_OPS:
>         case BPF_PROG_TYPE_EXT:
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf] libbpf: fix probe for BPF_PROG_TYPE_CGROUP_SOCKOPT
  2021-07-27 21:17 ` [PATCH bpf] libbpf: fix probe for BPF_PROG_TYPE_CGROUP_SOCKOPT Andrii Nakryiko
@ 2021-07-28 10:59   ` Robin Gögge
  0 siblings, 0 replies; 2+ messages in thread
From: Robin Gögge @ 2021-07-28 10:59 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Stanislav Fomichev, Networking, bpf, Quentin Monnet

On Tue, Jul 27, 2021 at 11:17 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Tue, Jul 27, 2021 at 7:41 AM Robin Gögge <r.goegge@outlook.com> wrote:
> >
> > This patch fixes the probe for BPF_PROG_TYPE_CGROUP_SOCKOPT,
> > so the probe reports accurate results when used by e.g.
> > bpftool.
> >
> > Fixes: 4cdbfb59c44a ("libbpf: support sockopt hooks")
> >
> > Signed-off-by: Robin Gögge <r.goegge@outlook.com>
> > Reviewed-by: Quentin Monnet <quentin@isovalent.com>
> > ---
>
> Looks good, I'll apply to bpf tree once this patch makes it into patchworks.

I think I'll have to resend the patch from my gmail account, rookie mistake
on my part for using my outlook account in the first place I guess.
>
> Meanwhile, looking at probe_load() seems like a bunch of other program
> types are not handled properly as well. Would you mind checking that
> as well and following up with more fixes for this? See also [0] for
> this whole probing APIs situation.
>
>   [0] https://github.com/libbpf/libbpf/issues/312

Yes, some other program type probes are broken at the moment. But
as far as I can tell fixing them won't be as easy for me as this one. I'm
currently working on implementing a feature probe API in cilium/ebpf,
once I have working probes for the types there I can try and translate
them to follow up with fixes here.
>
> >  tools/lib/bpf/libbpf_probes.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c
> > index ecaae2927ab8..cd8c703dde71 100644
> > --- a/tools/lib/bpf/libbpf_probes.c
> > +++ b/tools/lib/bpf/libbpf_probes.c
> > @@ -75,6 +75,9 @@ probe_load(enum bpf_prog_type prog_type, const struct bpf_insn *insns,
> >         case BPF_PROG_TYPE_CGROUP_SOCK_ADDR:
> >                 xattr.expected_attach_type = BPF_CGROUP_INET4_CONNECT;
> >                 break;
> > +       case BPF_PROG_TYPE_CGROUP_SOCKOPT:
> > +               xattr.expected_attach_type = BPF_CGROUP_GETSOCKOPT;
> > +               break;
> >         case BPF_PROG_TYPE_SK_LOOKUP:
> >                 xattr.expected_attach_type = BPF_SK_LOOKUP;
> >                 break;
> > @@ -104,7 +107,6 @@ probe_load(enum bpf_prog_type prog_type, const struct bpf_insn *insns,
> >         case BPF_PROG_TYPE_SK_REUSEPORT:
> >         case BPF_PROG_TYPE_FLOW_DISSECTOR:
> >         case BPF_PROG_TYPE_CGROUP_SYSCTL:
> > -       case BPF_PROG_TYPE_CGROUP_SOCKOPT:
> >         case BPF_PROG_TYPE_TRACING:
> >         case BPF_PROG_TYPE_STRUCT_OPS:
> >         case BPF_PROG_TYPE_EXT:
> > --
> > 2.25.1
> >

-- 
Robin Goegge
Tel. +491732422154

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-28 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <DB8P193MB0581FEB4CB90263430546C4C88E99@DB8P193MB0581.EURP193.PROD.OUTLOOK.COM>
2021-07-27 21:17 ` [PATCH bpf] libbpf: fix probe for BPF_PROG_TYPE_CGROUP_SOCKOPT Andrii Nakryiko
2021-07-28 10:59   ` Robin Gögge

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).