๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6056

Re: [PATCH net v3] net: gso: validate transport header before computing segment length

#6056
From: Eric Dumazet
Date: Wed, 21 Oct 2026 15:49
49 lines
11027 bytes
Le mer. 21 oct. 2026 ร  17:13, Michael S. Tsirkin <mst@redhat.com> a รฉcrit :
>
> If a TSO packet is processed in the stack before a transport
> header was ever established, the TCP data offset is read through the
> unset header offset, far outside the packet.
>
> This was demonstrated by syzkaller, back when the input path did not
> dissect such packets: a virtio net header supplying a malformed
> network header was enough.  Qdisc length estimation has carried a
> guard against exactly this since
>
> commit a0dce8752193 ("net: Skip GSO length estimation if transport header is not set");
>
> the GSO length validators never got one.
>
> We used to, but we no longer allow such packets in: since
>
> commit 44378d02c5aa ("net: always dissect GSO packets in __virtio_net_hdr_to_skb()")
>
> the virtio net input path dissects all GSO packets.
>
> But as a defence in depth measure

I do not think we want this.

The root cause was fixed at the source by 44378d02c5aa. This patch adds
code to skb_gso_validate_network_len(), which ip_finish_output_gso() and
ip6_finish_output_gso() call for every GSO packet, including locally
generated TCP, to guard against a state the stack no longer produces.

The Fixes: tag is misleading: by your own changelog, nothing reachable is
fixed, yet this would be routed to stable.

As for bpf_skb_adjust_room(): if it can leave an inconsistent transport
header, please send a fix for bpf_skb_adjust_room(). Note that what it
would leave behind is a stale offset inside skb->head, which this check
does not catch anyway. Drivers using skb_tcp_all_headers() would still
read it.

Turning a broken invariant into "does not fit" also has odd side effects
(ip_forward() sending ICMP FRAG_NEEDED with a bogus MTU, policers
applying their exceed action) and hides the producer instead of
exposing it. If you want coverage, a DEBUG_NET_WARN_ON_ONCE() as in
skb_network_header_len() is the right tool: free in production, and
syzbot will tell us who produced such a packet.
Technical Details
Message-ID: <CAL4Wiir3NTn8VdbzS=sV3tfz4XGoBXmSfjm96k9SBMTiYBBtjw@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-350086-linux-kernel-netdev=dewy.ru
References: <52b8bfe4ee848aff8ace47752352de486171d45f.1792595507.git.mst@redhat.com>

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-350086-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3] net: gso: validate transport header before
 computing segment length
Date: Wed, 21 Oct 2026 17:49:35 +0200
Organization: Usenet Network
Message-ID: <CAL4Wiir3NTn8VdbzS=sV3tfz4XGoBXmSfjm96k9SBMTiYBBtjw@mail.gmail.com>
References: <52b8bfe4ee848aff8ace47752352de486171d45f.1792595507.git.mst@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="4188410"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:l3UXrOpbdfyRCczmyVYs0Yo44Y4= sha256:o8pOFZ9pKT59eX/fg393jCKJeYeE6NdzxbLFT7iv9cs=
	sha1:TgteFHWnijHXLrYHhvInlOYImro= sha256:dDtemNEvPXCLdYchc6HJXPa8LdaZ094IhW6KW2BU3qg=
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 CF65D11105D; Wed, 21 Oct 2026 18:55:29 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, 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 8Mmqv9JIJtxh;
	Wed, 21 Oct 2026 18:55:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-350086-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 2BBD711102A; Wed, 21 Oct 2026 18:55:15 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 37D7F2C6B8; Wed, 21 Oct 2026 15:49:59 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792597796;
	b=LQq7SnukkOovP2oC5kA6KrqB3V71XMJXi5Chr9OWu2pC03pRS0KXPXzuSbG6636q7zSX
	 0SEjUCMjmImhSk1YUcOXqkNfYahP9JulkPwj82rUPNLEQYSr7DTO5wZCs9YwWtvBMAjyC
	 puPQjq26h9qlGjJL/LqON846lvStGkwn+yhKPHS/tlKDGJ1GyLxJ0f1D2RyLzDm4Hpawa
	 V3rz5xgKAvEx0O2ZUk1njT8k0zBPYtRhhRaQb7Mkdtod2nsgPGueBDEsZoLOrMadyZd/9
	 nUNFtMefigE/ZcAeq0KXXI2uUxcPt1EhOcUFsGDhkwqqeaS7gGvZsUm05vXjNAlKBaQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792597796;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date:
	 X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=5i/dKlQItIVWlNQQt5TNx8F6ezv0iQQLPMD7DB2X0b8=;
	b=HuWvjr3YN2i+HEFCWDVDYlkQqRN3XEUlW9KSX5Fd0rMB4W8tZnsJAUqUt4H0QxZ3GcWw
	 e9uAGbxhyEuxpE171IPR7Yn6H6TNwgFY8k8zJOeYIWm5uJt5dL86CjLV5g1QI4XK7A2X6
	 FT6u8m78QzMTZqIc60AiqIHZo7JBhGIJCE7vXptGf46rfhWgx5Y/xWhXKx/ICJXg4k9lX
	 fdqQMd4y5/sk9XcfFlouZysvGnjgVTWbAnA+IsA20VNfVzbP8zEOY8esdL10/4YW/F42B
	 YSgYcJdR7oNt0NAv51wrwLMI73Z9Hss7/r6G6J/eIVwCFLyQEIbnWeBphYGr3SfJ0KA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=F5Df4mb8;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 435D4606A31A;
	Wed, 21 Oct 2026 15:49:56 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=F5Df4mb8
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792597790;
	b=5D+y9qmZJ0qKCB+K1/gYRkkMPe6DNhbp2GQ5Z13w5rx4+IRJoFs8R0r2o1dM8eHVkYT9
	 LVJwUU4Kx32YC2WIV54Sl1M5KpRhrIPLJhgT3Ynsrq9djcWavnCH9bNbRs9Sics1orbsy
	 CJ7ms25EAyIxFLSCFStAU73Y7C8CFMoQPxy3M6d6h+XyTapyrbWpTZq9iYz2twsqjhtvt
	 /fJb34ChMreAadnqy5qI2H5XWBINMaQzu97v9EgXDWqIzkVJer6dIESVC+99JPsanuT12
	 19CD5WviltzUl+ENHInD/owsKkYB7NmxuWV1bROTaXxbqgRBmSNidLDlMUQMh3S6FUw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792597790;
	h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
	 X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
	 From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
	 Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=5i/dKlQItIVWlNQQt5TNx8F6ezv0iQQLPMD7DB2X0b8=;
	b=iaHbtvRgsXG1X0OnvVQk3dv1GjOgQ4m5JCoOtuxImpM9QiDax+T/GJaKETOM4DxOKw0i
	 LvzYXjVqajXILIhko7iF5SJpBUzHJKaLCuviiyCtrM/HyXZ9RmA+fD2JEvYR1FFUKKBth
	 HINljFHdhHAFkBSKAPvCyKOb4cJtn0L+e5gUFr8tAPPvhJlm5bfGHzewDewvmUnE6+l63
	 Dkj4rWRqSvBn6NtETnUOZSYMoj1fk8CZ/S4osNduY8W1vkhSNfK7eCKM62GequJ7AGDbK
	 MvDztxnEiHNsqsyGioSJOq6sbataL7N2JrO6AxG78OtyVwt9EshdNs5uAIkB+TtKYxg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=F5Df4mb8;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29780606A31B
	for <netdev@vger.kernel.org>; Wed, 21 Oct 2026 15:49:50 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07E4B1F000C9
	for <netdev@vger.kernel.org>; Wed, 21 Oct 2026 15:49:50 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792597790;
	bh=5i/dKlQItIVWlNQQt5TNx8F6ezv0iQQLPMD7DB2X0b8=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=F5Df4mb83F6U2s2se5pn0jy/Wo+RD8CTks0HWbOfFXQJREc5vx1G964WA6uOr7nnJ
	 Nte/t/rVqq5eLOn79vcnpmrsdOtldJFqvoAErT04KlOaqWHgEuz8hbeazUm6ZvpWRG
	 5IHCRgtb13iHxc/gI4xeCFC3hFz6PdzH/j23FeX7vgF5g8fKB4drwAl/4IcoBd4V8z
	 uaHAihXUr1VsxtSCXrvwv2kKrA7SDT+H/pK/oF9jpev+iGJn5JomCpetnEbpyYP0my
	 5/0DMZNpWOiAWx2uXuZPGjL72BJoqlyH2zZ3Jgfqu4F6MZsYmpEeZ+I4TkSmrJ4pZH
	 sDy00yEpGvwew==
X-Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-3aae7df0971so7490831fa.1
        for <netdev@vger.kernel.org>; Wed, 21 Oct 2026 08:49:49 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AKwUvBwOlBbKiCDnH6Vhi55qaIrfYQOjF+ZdCxOTYzsLPiGoiPkTXg0+Xxos2EcGfTWwUd//jYUnwn4=@vger.kernel.org
X-Gm-Message-State: AFq9FYKLd+DFO+EMXAL9CWkr6/+0CeSfwrNJBs7wtUYlOyMwc4GFI87F
	QDZDtv2itIdgsNviTi/Fv0rmynJAOAJGa28hPnQndec7mA88SnjhUxnd1FdTpfjnhlmx5EcLXNO
	zhusA8glfOwE+QJaqENSazrcHj608uV0=
X-Received: by 2002:a05:6512:ba4:b0:5bf:a678:d516 with SMTP id
 2adb3069b0e04-5bfa678d646mr92472e87.9.1792597788716; Wed, 21 Oct 2026
 08:49:48 -0700 (PDT)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <52b8bfe4ee848aff8ace47752352de486171d45f.1792595507.git.mst@redhat.com>
X-Gmail-Original-Message-ID: <CAL4Wiir3NTn8VdbzS=sV3tfz4XGoBXmSfjm96k9SBMTiYBBtjw@mail.gmail.com>
X-Gm-Features: AclHuK8ol3_rFLLxuCeAxv7ojvVgYmPnagcrD83eaOPiz7WOH39uKcf84ElayPE
X-Cc: linux-kernel@vger.kernel.org, Willem de Bruijn <willemb@google.com>, 
	"David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, 
	Simon Horman <horms@kernel.org>, Max Krasnyansky <maxk@qualcomm.com>, 
	Rusty Russell <rusty@rustcorp.com.au>, netdev@vger.kernel.org, bpf@vger.kernel.org