bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Florian Westphal <fw@strlen.de>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org
Subject: Re: [PATCH bpf v2] bpf: netfilter: add BPF_NETFILTER bpf_attach_type
Date: Mon, 5 Jun 2023 15:02:49 -0700	[thread overview]
Message-ID: <CAEf4Bzbw2zccn3eQd4Cb6+Em-aoQvLS4v7czQ7BjZvgUVq9-FA@mail.gmail.com> (raw)
In-Reply-To: <20230605131445.32016-1-fw@strlen.de>

On Mon, Jun 5, 2023 at 6:15 AM Florian Westphal <fw@strlen.de> wrote:
>
> Andrii Nakryiko writes:
>
>  And we currently don't have an attach type for NETLINK BPF link.
>  Thankfully it's not too late to add it. I see that link_create() in
>  kernel/bpf/syscall.c just bypasses attach_type check. We shouldn't
>  have done that. Instead we need to add BPF_NETLINK attach type to enum
>  bpf_attach_type. And wire all that properly throughout the kernel and
>  libbpf itself.
>
> This adds BPF_NETFILTER and uses it.  This breaks uabi but this
> wasn't in any non-rc release yet, so it should be fine.
>
> v2: check link_attack prog type in link_create too
>
> Fixes: 84601d6ee68a ("bpf: add bpf_link support for BPF_NETFILTER programs")
> Suggested-by: Andrii Nakryiko <andrii.nakryiko@gmail.com>
> Link: https://lore.kernel.org/bpf/CAEf4BzZ69YgrQW7DHCJUT_X+GqMq_ZQQPBwopaJJVGFD5=d5Vg@mail.gmail.com/
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---

There was one more place that needed adjustment in
tools/lib/bpf/libbpf_probes.c and another in tools/lib/bpf/libbpf.c
for BPF_NETLINK -> "netlink" string representation. I fixed it up and
pushed it to the bpf tree, but for future submissions please make sure
to run all selftests locally and make sure they all pass.

>  include/uapi/linux/bpf.h       | 1 +
>  kernel/bpf/syscall.c           | 9 +++++++++
>  tools/include/uapi/linux/bpf.h | 1 +
>  tools/lib/bpf/libbpf.c         | 2 +-
>  4 files changed, 12 insertions(+), 1 deletion(-)
>

[...]

      reply	other threads:[~2023-06-05 22:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05 13:14 [PATCH bpf v2] bpf: netfilter: add BPF_NETFILTER bpf_attach_type Florian Westphal
2023-06-05 22:02 ` Andrii Nakryiko [this message]

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=CAEf4Bzbw2zccn3eQd4Cb6+Em-aoQvLS4v7czQ7BjZvgUVq9-FA@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=fw@strlen.de \
    --cc=netdev@vger.kernel.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).