๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11827

Re: [PATCH net] net: reset transport_header for ndo_features_check

#11827
From: Matt Vollrath
Date: Thu, 05 Nov 2026 17:42
77 lines
14894 bytes
On 11/4/26 13:16, Eric Dumazet wrote:
> Le mer. 4 nov. 2026 ร  18:55, Matt Vollrath <tactii@gmail.com> a รฉcrit :
>>
>> ndo_features_check() can see a transport_header that does not point at
>> the L4 header, while ndo_start_xmit() for the same skb sees the right
>> one.
>>
> 
> The change looks fine to me, but this is net-next material: the bug is
> very old, there is no report from real hardware, and the patch changes
> what every ndo_features_check() sees. Please drop the Cc: stable and the
> Fixes: tag. For 6.1.y, send a backport of 5f0764cb1c81 to stable@
> separately.

I'll be proposing a different series which fixes transport_header at the
source instead of patching one place where it matters that it's wrong. It
turns out there is more than one place.

I've sent the backport of 5f0764cb1c81 to stable.

>> Commit 663ead3bb8d5 ("[NET]: Use csum_start offset instead of
>> skb_transport_header") made csum_start authoritative because receive
>> processing overwrites transport_header, and resets it from csum_start
>> "just before we push a packet with partial checksums off into the device
>> driver". That reset, which now sets inner_transport_header instead for
>> encapsulated skbs, sits in validate_xmit_skb(), on the non-GSO path
>> only, after netif_skb_features() has called ndo_features_check().
>>
>> So the hook sees a wrong transport_header for a CHECKSUM_PARTIAL skb
>> (after GRO, or from a container or VM) when no stacked device (VLAN,
>> bond, tunnel) ran validate_xmit_skb() first and something earlier
>> pointed the header elsewhere:
>>
>> * IPv6 forwarding with a destination options or routing header:
>>    ip6_rcv_core() sets it just past the fixed header, and only hop-by-hop
>>    options are stepped over before forwarding.
>> * br_nf_pre_routing_ipv6() does the same for bridged IPv6.
>> * seg6 inline, rpl and ioam6 point it at the header they insert.
>>
>> A hook that bounds header lengths with transport_header can then leave
>> offloads enabled that the hardware cannot handle. For example,
>> i40e_features_check() limits IPLEN using skb_network_header_len(),
>> which returns 40, while i40e_tx_enable_csum() writes the real length
>> into the 7-bit IPLEN field, so more than 468 bytes of extension headers
>> overflow into L4_FC_LEN. Rather than make every driver measure from
>> csum_start, give the hook the headers the transmit path gets.
>>
> 
> Only from validate_xmit_skb(). ip_finish_output_gso(), some qdiscs and
> netpoll still call netif_skb_features() without the reset.
> 
> The changelog is also too long, something like this would be enough
> for v2:
> 
>      net: reset transport header before ndo_features_check()
> 
>      For CHECKSUM_PARTIAL skbs, validate_xmit_skb() resets
>      transport_header (inner_transport_header for encapsulated skbs)
>      from csum_start, but only after netif_skb_features() has called
>      ndo_features_check().
> 
>      The hook can therefore see a transport_header left elsewhere by
>      the receive path, while ndo_start_xmit() sees the reset one. For
>      example, ip6_rcv_core() leaves it after the fixed header of
>      forwarded IPv6 packets with destination options or a routing
>      header, and seg6, rpl and ioam6 point it at the header they insert.
> 
>      i40e_features_check() then bounds IPLEN with a 40 byte
>      skb_network_header_len(), while i40e_tx_enable_csum() programs the
>      real length, which can overflow the 7-bit field.
> 
>      Move the reset before netif_skb_features(). Skbs that are not
>      segmented in software reach ndo_start_xmit() with the same headers
>      as before, and software GSO parses the headers itself.
> 
> pw-bot: cr
Technical Details
Message-ID: <2c861cd8-29b5-4779-98e0-0be49a04023c@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-357528-linux-kernel-netdev=dewy.ru
References: <20261104175517.2395704-1-tactii@gmail.com> <CAL4WiiocQ1-jpdkYi1u_5T3J7oXK9qXnKDV+316Nd9KtDvsOKw@mail.gmail.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-357528-linux-kernel-netdev=dewy.ru
From: tactii@gmail.com (Matt Vollrath)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net: reset transport_header for ndo_features_check
Date: Thu, 5 Nov 2026 12:42:16 -0500
Organization: Usenet Network
Message-ID: <2c861cd8-29b5-4779-98e0-0be49a04023c@gmail.com>
References: <20261104175517.2395704-1-tactii@gmail.com>
 <CAL4WiiocQ1-jpdkYi1u_5T3J7oXK9qXnKDV+316Nd9KtDvsOKw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3693930"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ZLHsjoZnqndB0uwWSnMviJXciy0= sha256:AZBKoXEy4qzrKhPOds0yLIYIWk11iLtjMNkqhiLvPfo=
	sha1:AlabIFLBS/hrZWNi0UO82YEfaZg= sha256:Eorc3qif8D8/3KGclZZB12puCQZZ0jp8LwMy7KVRjJo=
Content-Language: en-US
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 8359611303F; Thu,  5 Nov 2026 20:45:07 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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=gmail.com
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 gov6RwUV2nqp;
	Thu,  5 Nov 2026 20:45:04 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-357528-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 36C5F112FEC; Thu,  5 Nov 2026 20:44:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id B6382609C37; Thu,  5 Nov 2026 17:42:21 +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=1793900541;
	b=yozLLAYSl6ApzEY//X7hgLTtfYAOC+Nt1cjeq4/ztEFTOh8BrnlUykWKKo1l8L+V17Um
	 tlgO50wSHmM5FAzmdpJT52ge99vit0J+RdUlXULgpOBN5cv6bqWYEmPnULdMytua9PxzC
	 DF0qewaoHnA7EcDdQT77Ril46X5CuG1ZBiTFkLvGRODjE09OAwqbZj4k2Qe16xvKS57NM
	 ewsvdhbb6oba9EnZ0BXFLrZgiUpK+minn4vi415bbdXgLM7CyLfIJbzeRn2+rrYA4En9E
	 J02JnADCJaVgeV6pIEg2c5V2MMQi5NnadZ56wJxkoaLinq1aXS+JHWRCI5W+iMd+hEQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793900541;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=7mW/W2zUvZRbJ83TvA9tsndEDGm8qEAN4uyhPOEw0Pw=;
	b=x3eIOoPMZQjKN3gjdnKE14Daz4T4w3ZeNZS4L97WV/Rt7zKcWQE3vqpJqmDrUahulGvj
	 +Z92ayCdU6QSeYIXJuyA1aST/q2vxXdJ2Far2sPSXoWajvQWTdupr51heCUFxHzf1je1z
	 hZa1o9BiwGhhqdcV3s1YOgaH9HF+pXSBCNjwqRTWKNkK7PB2qapAD6EcDgQ5mqjfnzpIX
	 IqUd8XV0DIDvM/QlB7/EBkEiUZCu2pQcuvfasrmAScid+GR05tSKva88vO5eeUigUH8UY
	 x2RZMT1BG3fJf/Sv4CCMS5ynerrD58moxjcrP1uVK9rY+zMc47eQ82IXbw3mWYMbvhw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=KG+S64On;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 E61CD606A339;
	Thu,  5 Nov 2026 17:42:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=KG+S64On
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.182
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793900540;
	b=m41ogLlp2Vh1s+zHGinoH7TN/AA8N/dHS3XMYfgpAnQpqRIwUEQDcO3TE0GPqXr7qOYL
	 tAznT0U1VPI0tfrV2JZ+FJ1+z24UVLGGqnUMcHNrtDwXjXH/rNQyhsg47xInCXR6Lk+tP
	 4Tw2oI5X5cNpm6zuIoOf0eaOcBK2vXO196ILUHYXxL8m1UDW+Akk+SM2xQwMnVDjTr+H6
	 KyCHaqnQQWDSJO0nC4660yCVIxD9WLcCioycQKn/Dw/ApTQcAtczouuHyLlvqE5GibTe1
	 7SYES5pQrg5y3gnF6g/jXoKGzhuP1t+aj1Yvym3f2KyBEbOSjK/R2Zr4Uh+RvtK+3Xg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793900540;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-ID:Date:
	 MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language:
	 From:In-Reply-To:Content-Type:Content-Transfer-Encoding;
	bh=7mW/W2zUvZRbJ83TvA9tsndEDGm8qEAN4uyhPOEw0Pw=;
	b=NeuTGMhWPCnJCzqPKMpBfoZrO7sgow7POyEiNNITXgcjpIfJSIx46SOaear1WMHfmonI
	 dp9094uz/tV0EofVkt8mC6Ne4DHFu8yLIpM+u6jDLwCrEbilpu+oJTiEMy+oELr4iF7ED
	 lEdBTOwXGjKslvD5emtHGUJ6Ztj2F5jVs6XUaNtiyBgDpS2VxCrKiYcM9VbRf9EPxxsIu
	 MSuVRcj7ev2V47W30pwjl0+mzR5Uwtw1iAUiaGq2H4zMIvJJASpd4BIt9KwNo1Xht1sRJ
	 DiVKi+aGtxa45DfY77HorTI79JzVvTvJQMEmyPks6VpQarJagJP1bgXePZWYK96WwrQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=KG+S64On;
	arc=none smtp.remote-ip=209.85.128.182
X-Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B259C606A326
	for <netdev@vger.kernel.org>; Thu,  5 Nov 2026 17:42:19 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B259C606A326
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-8b0d91601bdso7728017b3.1
        for <netdev@vger.kernel.org>; Thu, 05 Nov 2026 09:42:19 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793900539; x=1794505339; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=7mW/W2zUvZRbJ83TvA9tsndEDGm8qEAN4uyhPOEw0Pw=;
        b=KG+S64OnRQhNJdrRc5VVrIRK3+SoA7zTQ5EbgjknSenrZM2eiyYZMO/r/TAj/d+Skj
         gGo2gP5DbB2IeEzu+qNLnUHhkoYGnKNuw/bvaNrDCEBcwY7BnhxnWaEUs/emwJKiMDmd
         yY3QJagIryIqNXdPI9SL+p3NysHQwappzMzT4XDR0aTRXEPpjPdRsrS6ifPXAr+fBvqJ
         a17hi43V/wsqgvkNYcz9Ax+xRFGj0KexoF8Swy9UTQmA5K27NtNTpTC4QQuInu9RVyOh
         yfpPjhIIF4qiYWZET622OR3UNiD03z1yA/U9Gou3p/MEiwYasQd06s2ijEpkg1DgSXG6
         k92w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793900539; x=1794505339;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=7mW/W2zUvZRbJ83TvA9tsndEDGm8qEAN4uyhPOEw0Pw=;
        b=xcnDSv7nFxozJM71HI6dDhqZZMfFxJKxcd1Xmyk7tAq4z6gfL1KwmqnY0vfM+5cNNw
         nwjXeEOCUrzjRU2Myq5+g2qRUyaSQBN6+U4FF9LNz3eAjVEDzjekT4n3L51Tj4Bj7rJa
         AR9pKJlhUlURyRW8MJlJvfV100hMe2D0E+ePmfbBEA6QJgcYRD+QmHgyYj3mRtJfthot
         2t2wE0U5Qm4dnDvLS6gqitANtISjepGNRQMlUuyjnfeJW6J5+8kl9n+a4r/c57e2gJ0k
         9ycj1DyPhurF60QazFPm4FSpsEZj6o9DgPrrvNBJP+fbqn3Fsvn2vt5Q6dQVALB4Pe6R
         26aw==
X-Gm-Message-State: APuU4Z+ehkH90vGwex2SnD5waRicny7+2eYvfKBKdkJ2WLeLpOtgwi2m
	iEGKj+vtaiREQyDda1Iu6j5RG2X27HDiFeDkaAc1w1T7tNcD3S/zpycj
X-Gm-Gg: AYBFou2dfOrzd6NRtNuPNkSJQ1ZqKCUQAkj2aFqPCg+zWvRXmllcUpZVFtyw9alQXq3
	VotztYaAu4X3z/BmbPDAzehaR8VXe9hG8DIjbm6dgY5qPvOWyLGJPKRhDMLhZe8gKdP+g1ktikU
	9WX0j8kKtYpP+3lEqnAEPIoBKq8cRf8BzbdZyh3llFX/nD00cbIMoiXXeBRzjl9g4KuiD4gcMnw
	uI3yVrr6PiEVaaDiBGCLksetXgz/nx5fuRrfqOu65HpKtddsyvOtS/+TdmhIpV2TOhqv21yGssD
	11NbCs0+Xx09dYTZKNAqpb92/MI7xbto5K5srTbVpot3ZxAdlUa3eHKe014jKXTjzuBXsKYMAJW
	IzZMdmvnjgwKHYz+riLeIMGeG5+fTvr/+IfZ4ZeFyPR3c1JcKEd+KeDQVEwbMcfNjpefpACKkAK
	fVdoHyAEsktvqT1a/cTEFuUUvE8Y/A5wjtD+QnXIxmbFH1fQFDpfBMEhZ0uBnrZ6RIQfocoLUSZ
	1qIgMtyruCUw8EECYTri7R7rRQvK52zXVJ5jruBDk7s93o8CMrN7ifmCMXyaU72JeWKpDaLLIWr
	qr36EZIDyx4Afh8LFCJD66nUZ1YDPpBDHu79vfASUqniwMbzoA==
X-Received: by 2002:a05:690c:a012:b0:8b0:e13c:2852 with SMTP id 00721157ae682-8b328db53bfmr17577147b3.7.1793900537616;
        Thu, 05 Nov 2026 09:42:17 -0800 (PST)
X-Received: from ?IPV6:2600:6c5c:6b00:316::23? ([2600:6c5c:6b00:316::23])
        by smtp.gmail.com with ESMTPSA id 00721157ae682-8b33f5f2e0fsm795357b3.4.2026.11.05.09.42.16
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Thu, 05 Nov 2026 09:42:17 -0800 (PST)
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-User-Agent: Mozilla Thunderbird
X-Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
 Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
 Simon Horman <horms@kernel.org>, Willem de Bruijn <willemb@google.com>,
 Alexander Duyck <alexanderduyck@fb.com>,
 Tony Nguyen <anthony.l.nguyen@intel.com>,
 Przemek Kitszel <przemyslaw.kitszel@intel.com>
X-In-Reply-To: <CAL4WiiocQ1-jpdkYi1u_5T3J7oXK9qXnKDV+316Nd9KtDvsOKw@mail.gmail.com>