From: Vincent Bernat <vincent@bernat.ch>
To: Craig Gallek <kraig@google.com>
Cc: Alejandro Colomar <alx@kernel.org>,
linux-man <linux-man@vger.kernel.org>,
Martin KaFai Lau <kafai@fb.com>
Subject: Re: [PATCH] man/man7/socket.7: fix documentation for SO_ATTACH_REUSEPORT_EBPF
Date: Mon, 3 Nov 2025 21:28:04 +0100 [thread overview]
Message-ID: <b6486fae-b0d2-48f2-a57e-371ae960e93f@bernat.ch> (raw)
In-Reply-To: <CAEfhGiz9OLu=arVoPFJhYTr3h-wB5QR5sOkgNDMzwR+74NUEBw@mail.gmail.com>
On 2025-11-03 17:31, Craig Gallek wrote:
> > On Mon, Oct 27, 2025 at 02:17:00PM +0100, Vincent Bernat wrote:
> >> When using eBPF, the program should not return an index, but a
> >> decision (SK_PASS/SK_DROP). The socket should be selected using the
> >> sk_select_reuseport helper.
> >>
> >> Cc: Craig Gallek <kraig@google.com <mailto:kraig@google.com>>
> >> Signed-off-by: Vincent Bernat <vincent@bernat.ch
> <mailto:vincent@bernat.ch>>
> >
> > Would you mind adding a Fixes: tag for the commit that introduced the
> > incorrect text?
>
> This is 1fa871f5378e (2016-03-01; "socket.7: Document some BPF-related
> socket options")
> > Also, do you have a guess of why the wrong text was written? It
> would
> > be useful to have an idea of that.
>
> Not a clue, but maybe let's wait when Craig comes back from vacation so
> he could say if there was a change or not and tell if I am correct.
>
>
> It's been a while since I've used this code, but it looks like the
> sk_select_reuseport helper was added a few years later by Martin KaFai
> Lau in 2dbb9b9e6df6. The execution of the bpf program (run_bpf_filter
> in sock_reuseport.c) still uses the program's 'returned' value in both
> the cbpf and ebpf cases, but it looks like Martin's change tightened up
> the 'type' of eBPF program that can be used for this purpose and
> included this helper function to allow for an explicit validation
> instead of just having the program return a raw integer value.
>
> So I think this is just a case of the documentation not keeping up with
> the code. I'm less familiar with the PASS/DROP syntax, but I'm guessing
> that came along after the initial implementation of these reuseport BPF
> programs as well.
>
> In any event, my quick read of the code lines up with your proposed
> documentation change. It might be worth having Martin verify as well,
> but this looks good to me.
OK, so, two things are possible and the kernel selects depending on the
program type (BPF_PROG_TYPE_SOCKET_FILTER or BPF_PROG_TYPE_SK_REUSEPORT).
if (prog->type == BPF_PROG_TYPE_SK_REUSEPORT)
sk2 = bpf_run_sk_reuseport(reuse, sk, prog, skb, NULL, hash);
else
sk2 = run_bpf_filter(reuse, socks, prog, skb, hdr_len);
So, I can update the documentation for that, as I have missed it.
Waiting for Martin feedback in case there is something else.
prev parent reply other threads:[~2025-11-03 20:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 13:17 [PATCH] man/man7/socket.7: fix documentation for SO_ATTACH_REUSEPORT_EBPF Vincent Bernat
2025-10-27 13:24 ` Alejandro Colomar
2025-10-27 19:11 ` Vincent Bernat
[not found] ` <CAEfhGiz9OLu=arVoPFJhYTr3h-wB5QR5sOkgNDMzwR+74NUEBw@mail.gmail.com>
2025-11-03 20:28 ` Vincent Bernat [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=b6486fae-b0d2-48f2-a57e-371ae960e93f@bernat.ch \
--to=vincent@bernat.ch \
--cc=alx@kernel.org \
--cc=kafai@fb.com \
--cc=kraig@google.com \
--cc=linux-man@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).