All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chris Mason" <mason@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	bpf@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH bpf 1/2] bpf: Don't use an unset inner transport header
Date: Sat, 05 Dec 2026 09:32:58 -0500	[thread overview]
Message-ID: <1796479968.1.15379.0@kernel.org> (raw)
In-Reply-To: <sashiko-outbox-251568@kernel.org>

On Sat, Dec 5, 2026, at 8:30 AM, sashiko-bot@kernel.org wrote:
> Can casting skb_inner_transport_offset(skb) to s16 clobber valid offsets
> >= 32768 and fail to reset offsets < -32768?
>
> virtio_net_hdr_tnl_to_skb() can set inner_transport_header from csum_start
> up to U16_MAX - 1 via skb_partial_csum_set().  Under the s16 cast, offsets
> >= 32768 sign-extend negative and are overwritten with off.

That takes a made-up virtio header.  Every segment repeats all of the headers,
so with 32 KiB of them, none would fit an Ethernet MTU.

> An unset inner_transport_header at 0 then has an offset below
> -32768, which wraps positive under s16 and skips the reset.

The decap still gets this one right.  bpf_skb_clear_encap() takes the larger
of the two headers, and that's the outer one then.

> Does resetting a wrapped inner_transport_header to off misplace it when
> skb->encapsulation stays set, while leaving the GRO bug unfixed?

It looks like this doesn't make anything worse.  A wrapped offset is about
65,000 bytes into the packet, so qdisc_pkt_len_segs_init() already drops it
without the patch.

The GRO bug is real, and Julius Bairaktaris has posted a fix for it:

https://lore.kernel.org/all/bf33ad6cb30391be0c7f80b4714fd96e9874ebd3.1795884313.git.julius@bairaktaris.de/

-chris

  reply	other threads:[~2026-12-05 14:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 12:56 [PATCH bpf 0/2] bpf: fix skb->transport_header after a decap Chris Mason
2026-12-05 12:57 ` [PATCH bpf 1/2] bpf: Don't use an unset inner transport header Chris Mason
2026-12-05 13:30   ` sashiko-bot
2026-12-05 14:32     ` Chris Mason [this message]
2026-12-05 12:58 ` [PATCH bpf 2/2] bpf: Keep skb->transport_header for ESP offload Chris Mason

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=1796479968.1.15379.0@kernel.org \
    --to=mason@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.