From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Nikolay Aleksandrov" <razor@blackwall.org>, <bpf@vger.kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>,
"Martin KaFai Lau" <kafai@fb.com>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Joe Stringer" <joe@wand.net.nz>,
"Kuniyuki Iwashima" <kuniyu@google.com>, <netdev@vger.kernel.org>
Subject: Re: [PATCH bpf] bpf: orphan unsafe prefetched sockets in skb_do_redirect
Date: Tue, 01 Dec 2026 03:15:06 +0000 [thread overview]
Message-ID: <DN92I9DOA37V.E50EY1A57O2O@gmail.com> (raw)
In-Reply-To: <20261130182424.2879469-1-razor@blackwall.org>
On Mon, Nov 30, 2026 at 10:24 AM Nikolay Aleksandrov <razor@blackwall.org> wrote:
> + sk = skb->sk;
> + if (!skb_at_tc_ingress(skb) || flags != BPF_F_INGRESS ||
> + !net_eq(sock_net(sk), dev_net(dev)) || !sk_fullsock(sk) ||
> + !sk_is_refcounted(sk))
> + skb_orphan(skb);
Can we orphan every prefetched socket instead?
tcf_bpf_act() does that for every verdict but TC_ACT_OK.
diff --git a/net/core/filter.c b/net/core/filter.c
index ea20fd2..1f4641e 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2565,6 +2565,9 @@ int skb_do_redirect(struct sk_buff *skb)
ri->flags = 0;
if (unlikely(!dev))
goto out_drop;
+ /* sk_assign is for local delivery, same as in tcf_bpf_act() */
+ if (skb_sk_is_prefetched(skb))
+ skb_orphan(skb);
if (flags & BPF_F_PEER) {
dev = skb_get_peer_dev(dev);
if (unlikely(!dev ||
Also imo bpf-next is fine for this bug.
pw-bot: cr
next prev parent reply other threads:[~2026-12-01 3:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 18:24 [PATCH bpf] bpf: orphan unsafe prefetched sockets in skb_do_redirect Nikolay Aleksandrov
2026-11-30 18:45 ` sashiko-bot
2026-11-30 18:54 ` Nikolay Aleksandrov
2026-12-01 3:15 ` Alexei Starovoitov [this message]
2026-12-01 8:20 ` Nikolay Aleksandrov
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=DN92I9DOA37V.E50EY1A57O2O@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=joe@wand.net.nz \
--cc=kafai@fb.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.