BPF List
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@google.com>
To: Shihuang Liu <shlomojune6@gmail.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, edumazet@kernel.org,
	 pabeni@redhat.com, willemb@google.com, davem@davemloft.net,
	kuba@kernel.org,  horms@kernel.org
Subject: Re: [PATCH v2] net: sock_reuseport: check program type on the migration path
Date: Thu, 19 Nov 2026 06:25:25 +0000	[thread overview]
Message-ID: <av6WPnah6aodSmuh@google.com> (raw)
In-Reply-To: <20261118153541.172499-1-shlomojune6@gmail.com>

On Wed, 18 Nov 2026 23:35:41 +0800, Shihuang Liu wrote:
> A BPF_PROG_TYPE_SOCKET_FILTER program can be loaded with
> expected_attach_type set to BPF_SK_REUSEPORT_SELECT_OR_MIGRATE and
> attached to a SO_REUSEPORT TCP group.  Closing a listener that still
> has queued children then runs it with a struct sk_reuseport_kern
> context even though it was verified against struct sk_buff, which
> KASAN reports as a stack-out-of-bounds in ___bpf_prog_run().
> Reaching this without CAP_BPF requires
> kernel.unprivileged_bpf_disabled=0; with
> CONFIG_BPF_UNPRIV_DEFAULT_OFF=y, the Kconfig default, the sysctl
> starts at 2.
> 
> reuseport_migrate_sock() decides from prog->expected_attach_type
> alone, a field user space sets that does not identify the program
> type.  Require BPF_PROG_TYPE_SK_REUSEPORT there and in
> reuseport_stop_listen_sock(); socket filters still work as
> selectors, so the selection path is unchanged.
> 
> Fixes: d5e4ddaeb6ab ("bpf: Support socket migration by eBPF.")
> Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>

Thanks

      parent reply	other threads:[~2026-11-19  6:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 15:35 [PATCH v2] net: sock_reuseport: check program type on the migration path Shihuang Liu
2026-11-18 15:38 ` netdev-bot+sinfo
2026-11-19  1:16 ` Alexei Starovoitov
2026-11-19  1:54   ` Jakub Kicinski
2026-11-19  6:25 ` Kuniyuki Iwashima [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=av6WPnah6aodSmuh@google.com \
    --to=kuniyu@google.com \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shlomojune6@gmail.com \
    --cc=willemb@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