BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Todd Freed" <toddfreed@meta.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net v2 2/3] bpf: don't redirect decrypted skbs from egress to ingress
Date: Wed, 18 Nov 2026 19:30:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-221863@kernel.org> (raw)
In-Reply-To: <20261117192411.247117-3-toddfreed@meta.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] bpf: multi-line comment style in bpf_xmit() in
  net/core/lwt_bpf.c
- [Low] bpf: inaccurate commit message claim about LWT xmit
  __sk_buff->tstamp access
--

commit f0449c06845a54209a334370bea65b715330a2a6
Author: Todd Freed <toddfreed@meta.com>

bpf: don't redirect decrypted skbs from egress to ingress

This commit drops decrypted skbs redirected from egress to ingress in
__bpf_redirect() and clears tc_at_ingress before running LWT xmit BPF
programs.

> Clear the bit before running an LWT xmit program, as __dev_queue_xmit()
> would right after. This also gives the program's other uses of the bit,
> in the redirect helpers and in its __sk_buff->tstamp access, the egress
> view, which matches where it runs.

[Severity: Low]
Is the commit message accurate about LWT xmit programs accessing
__sk_buff->tstamp?

lwt_xmit_verifier_ops uses lwt_is_valid_access(), which explicitly rejects
bpf_ctx_range(struct __sk_buff, tstamp), and lwt_xmit_func_proto() does not
expose bpf_skb_set_tstamp().

> diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
> index 72c86ff2a8472..4861fe2b4959a 100644
> --- a/net/core/lwt_bpf.c
> +++ b/net/core/lwt_bpf.c

[ ... ]

> @@ -327,6 +328,13 @@ static int bpf_xmit(struct sk_buff *skb)
>  		__be16 proto = skb->protocol;
>  		int ret;
>  
> +		/* The packet is on egress, but a forwarded one can still have
> +		 * tc_at_ingress set by the tc ingress hook of the device it
> +		 * came in on, until __dev_queue_xmit() clears it. Clear it
> +		 * now, so that the redirect helpers see the direction of this
> +		 * hook.
> +		 */
> +		tcx_set_ingress(skb, false);

[Severity: Low]
This isn't a bug, but BPF coding style places the opening /* of a
multi-line comment on its own line, with the text starting on the next
line.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117192411.247117-1-toddfreed@meta.com?part=2

  reply	other threads:[~2026-11-18 19:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 19:24 [PATCH net v2 0/3] net: don't redirect decrypted skbs to ingress, psp time-wait validator Todd Freed
2026-11-17 19:24 ` [PATCH net v2 1/3] net/sched: act_mirred: don't send decrypted skbs from egress to ingress Todd Freed
2026-11-17 19:24 ` [PATCH net v2 2/3] bpf: don't redirect " Todd Freed
2026-11-18 19:30   ` sashiko-bot [this message]
2026-11-17 19:24 ` [PATCH net v2 3/3] psp: only give time-wait sockets of PSP connections a validator Todd Freed

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=sashiko-outbox-221863@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=toddfreed@meta.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