๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #2747

Re: [PATCH] net: gro: don't chain linear parts larger than gso_size into frag_list

#2747
From: Eric Dumazet
Date: Tue, 13 Oct 2026 11:03
64 lines
8416 bytes
Le mar. 13 oct. 2026 ร  12:25, Sorah Fukumori <her@sorah.jp> a รฉcrit :
>
> skb_gro_receive() chains an skb into the frag_list of the held packet
> when its payload cannot be attached as page frags, i.e. when its head
> is not a page fragment and still holds payload.

>
> Fully linear GSO packets come from generic XDP. When the program does
> not support frags, netif_skb_check_for_xdp() linearizes any nonlinear
> skb with pskb_expand_head() and skb_linearize() and keeps its GSO
> metadata.

On Tue, Oct 13, 2026 at 12:24 PM Sorah Fukumori <her@sorah.jp> wrote:
>
> skb_gro_receive() chains an skb into the frag_list of the held packet
> when its payload cannot be attached as page frags, i.e. when its head
> is not a page fragment and still holds payload.

[...]

> Fully linear GSO packets come from generic XDP. When the program does
> not support frags, netif_skb_check_for_xdp() linearizes any nonlinear
> skb with pskb_expand_head() and skb_linearize() and keeps its GSO
> metadata.

I think the problem is a bit wider than what is described here.

skb_gro_receive() also reaches the merge: label from the head_frag
branch, when the frags do not fit:

if (nr_frags + 1 + skbinfo->nr_frags > MAX_SKB_FRAGS)
goto merge;

A GSO skb with a page frag head holding more than gso_size bytes of
payload is then chained in frag_list as well, and the BUG_ON() in
skb_segment() does not care about head_frag.

It seems an XDP program with frags support in generic mode could
get there: skb_pp_cow_data() builds a head_frag skb with up to
about one page of linear data, the rest in page frags, and
skb_copy_header() keeps the GSO metadata. Two such 64KB packets
can not share a single frags[] array.

Have you tried this variant with your reproducer ?

Your patch handles it anyway, since the check is done at the merge:
label, but the changelog should mention it.

>
> Fixes: 5eddb24901ee ("gro: add support of (hw)gro packets to gro stack")
> Cc: stable@vger.kernel.org
> Assisted-by: claude-opus-5-5
> Signed-off-by: Sorah Fukumori <her@sorah.jp>
> ---
>  net/core/gro.c | 4 ++++
>  1 file changed, 4 insertions(+)

Please use [PATCH net] in the subject for fixes.

The fix itself looks good to me, thanks.

Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Technical Details
Message-ID: <CAL4WiirpDVzho606z1gt5=1=MFykgTC2CbqdAkxnngSvBYq_Qg@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345586-linux-kernel-netdev=dewy.ru
References: <20261013102453.3272620-1-her@sorah.jp>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345586-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] net: gro: don't chain linear parts larger than gso_size
 into frag_list
Date: Tue, 13 Oct 2026 13:03:46 +0200
Organization: Usenet Network
Message-ID: <CAL4WiirpDVzho606z1gt5=1=MFykgTC2CbqdAkxnngSvBYq_Qg@mail.gmail.com>
References: <20261013102453.3272620-1-her@sorah.jp>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="2033236"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:XqsXQrjMX4tpUQK5a5HVC4zHhcc= sha256:JKrArXcbGhVQAp7bBZXgtwPToi+6BqJOf7wGOvalDTM=
	sha1:829OX4IDxiAvBXSq3nRs+eAmzIw= sha256:Qh0c0xJ03LAUIa9j8uxWeBVxUv0smnJzRkux2FYRDXY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 6386F10FE1B; Tue, 13 Oct 2026 14:15:30 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.34
X-Spam-Status: No, score=-1.34 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 1I27p1ImpWJz;
	Tue, 13 Oct 2026 14:15:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-345586-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 3FAF810FE17; Tue, 13 Oct 2026 14:15:19 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by tor.lore.kernel.org (Postfix) with ESMTP id 9727C2FA2E; Tue, 13 Oct 2026 11:05:31 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B87004EE842;
	Tue, 13 Oct 2026 11:04:04 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="df/QEOvb"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AFA14D7D4D
	for <netdev@vger.kernel.org>; Tue, 13 Oct 2026 11:03:59 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791889444; cv=none; b=QnPiwIwHRJHYY2b6BZOy4wOteJImq3yIIk7193+zo7CPUISTGOYMKmn3zCBjF8ypIOoQhFP4ELtitM5px7j/SBT1dCvzzXp1JKukcB2ozh3k3ybQaOZTwXqCvmwU3K5mN0zyQHbzhQbfpVJbjvP8mqv2m3diECOyP9PW75ePd8g=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791889444; c=relaxed/simple;
	bh=8GSkqv4QkypO8QEdwNJ18XjMvc3FQG9h1rQ/XxOiJzA=;
	h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
	 To:Cc:Content-Type; b=HXDWNx3MitTYeuW0sgA1OKZCMnw9pmUmMTOfDRV+68Ju1rGZS21Q1Ja1iniidvrrvivMmx+ebJqKLaE87deSzwaV3WtR2UF8IOV8zpWi8fu4FsZqsDXc8xPgwjApZmfqxGQIuGtZhRhbtyLlCTxGbKmN2SEq4McTHvKO3ydHCyw=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=df/QEOvb; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04E1B1F008A4
	for <netdev@vger.kernel.org>; Tue, 13 Oct 2026 11:03:59 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1791889439;
	bh=OFGX5cEcAGBVSLbwo2maF4cGWaEpCppHx8j1Z1dAgsU=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=df/QEOvbs4t983peDjJplnAehJS+fMIGucqMzKEPdXxnz/HoaZj6CfGdW2QkCbruP
	 wLRm2odoCoew55dk6ljH7IzoDl6uBCy0t7BXD0G333QUKz/RQzOZ5THLocDZINmO/H
	 6GAtbVic+iMSLIVRRH9WBe6vEhQjiKV+fmVvFda3qxxqssYPZiXEOzSC2jDOfhsfiP
	 6jCeZM3Pq7ds2OyNg5kW0vKWbyWiE++j1l2Clp5x+xUcmfrHIOS8c1c72N7LztPo//
	 C1X4lOimJufVnjPV4tnxJ5zIjZIBWTeci6jcxYXK0z2Vnr3LzAyTDbRn0p3AhwO5os
	 vXcQFtQCS9HMA==
X-Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-6de1ca1b05aso1813351eaf.0
        for <netdev@vger.kernel.org>; Tue, 13 Oct 2026 04:03:58 -0700 (PDT)
X-Gm-Message-State: AFq9FYLbBTH3JFjvvwm8ynUXg2/sPmQn/f6I5ft1UWxhoLYzvMPfBRBA
	9kgnDgbYN3rHuJmIHfjHAE59azzvNrTgIzhQR8BXQSlIrrp/LYiIWOAvv2mxJdGLtV6BCR8uLqZ
	Aq1/cZfAK7D+En7CZ2b7v9oAvCJaes3M=
X-Received: by 2002:a05:6820:2004:b0:6c9:80d8:a1ea with SMTP id
 006d021491bc7-6ef0eebcb40mr9815909eaf.39.1791889437993; Tue, 13 Oct 2026
 04:03:57 -0700 (PDT)
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261013102453.3272620-1-her@sorah.jp>
X-Gmail-Original-Message-ID: <CAL4WiirpDVzho606z1gt5=1=MFykgTC2CbqdAkxnngSvBYq_Qg@mail.gmail.com>
X-Gm-Features: AclHuK-WFlJ1I9lONTIdZBdj4iMjAgmdTOTDfsQ6amGBjyKepy2t-6ptu-IiQkg
X-Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, 
	pabeni@redhat.com, horms@kernel.org, willemb@google.com, lixiaoyan@google.com, 
	linux-kernel@vger.kernel.org