From: Paolo Abeni <pabeni@redhat.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
sashiko-reviews@lists.linux.dev
Cc: bpf@vger.kernel.org, network dev <netdev@vger.kernel.org>
Subject: Re: [PATCH net] net: reject a negative TCP header offset in qdisc_pkt_len_segs_init()
Date: Wed, 4 Nov 2026 09:41:34 +0100 [thread overview]
Message-ID: <f029172d-855b-4e93-8a86-d4aff72c9abb@redhat.com> (raw)
In-Reply-To: <DML39PMNWP8Q.7K2P5T3AG8LP@gmail.com>
On 11/2/26 23:46, Alexei Starovoitov wrote:
> On Mon, Nov 02, 2026 at 11:44 AM sashiko-bot@kernel.org <sashiko-bot@kernel.org> wrote:
>>> + /* A header in front of skb->data gives a negative offset. */
>>> + if ((int)hdr_len < 0 ||
>>> + !pskb_may_pull(skb, hdr_len + sizeof(struct tcphdr)))
>>> return SKB_DROP_REASON_SKB_BAD_GSO;
>>
>> [Severity: High]
>> Should the (int)hdr_len < 0 check be placed immediately after hdr_len is
>> computed rather than only inside the SKB_GSO_TCPV4 | SKB_GSO_TCPV6 branch?
>
> No. It's already explained in the commit log.
>
>> When (int)hdr_len < -8, hdr_len + sizeof(struct udphdr) wraps to an
>> unsigned int in [0x80000008, 0xffffffff] (> INT_MAX), which triggers
>> DEBUG_NET_WARN_ON_ONCE(len > INT_MAX) in
>> include/linux/skbuff.h:pskb_may_pull_reason() before returning
>> SKB_DROP_REASON_SKB_BAD_GSO.
>
> Not a bug. That's CONFIG_DEBUG_NET only and the warn is right:
> the header is stale.
>
>> Can this write uh->len (and uh->check in bnxt_sw_udp_gso_xmit() and
>> enetc_tso_hdr_csum()) before the start of the header buffer when
>> skb_transport_offset(skb) < -4?
>
> No. The driver doesn't see this offset.
>
>> Third, for other GSO types (such as SKB_GSO_FRAGLIST, SKB_GSO_UDP,
>> SKB_GSO_SCTP, or SKB_GSO_ESP), hdr_len remains 2^32 - |offset| at the end
>> of qdisc_pkt_len_segs_init():
>>
>> When (gso_segs - 1) * |offset| > skb->len, can qdisc_skb_cb(skb)->pkt_len
>> underflow in 32-bit unsigned arithmetic to ~4.29 GiB (exceeding
>> QDISC_PKT_LEN_MAX), causing deficit-based schedulers such as drr_dequeue()
>> and ets_dequeue() to spin in their deficit-refill loops?
>
> No.
FTR the nipa sashiko instance dismissed the above concerns autonomously:
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261101194433.2637113-1-alexei.starovoitov@gmail.com
you can reasonably safely refer only to such instance when submitting
patches to net/net-next.
/P
next prev parent reply other threads:[~2026-11-04 8:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 19:44 [PATCH net] net: reject a negative TCP header offset in qdisc_pkt_len_segs_init() Alexei Starovoitov
2026-11-01 19:49 ` netdev-bot+sinfo
2026-11-03 19:37 ` Eric Dumazet
[not found] ` <sashiko-outbox-194018@kernel.org>
[not found] ` <DML39PMNWP8Q.7K2P5T3AG8LP@gmail.com>
2026-11-04 8:41 ` Paolo Abeni [this message]
2026-11-04 16:52 ` Alexei Starovoitov
2026-11-04 12:04 ` Michael S. Tsirkin
2026-11-04 12:30 ` patchwork-bot+netdevbpf
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=f029172d-855b-4e93-8a86-d4aff72c9abb@redhat.com \
--to=pabeni@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox