🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6674

Re: [PATCH net-next 01/15] net: skbuff: make skb_copy_and_csum_bits() report unreadable frags

#6674
From: netdev-bot+sashiko
Date: Fri, 23 Oct 2026 04:51
134 lines
13264 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] Missing Fixes: and Cc: stable tags on a data-integrity fix.
- [Low] The new comment in skb_copy_and_csum_dev() reads: "On failure the
  rest of @to is zeroed; leave the checksum alone so the frame goes out…

--

net: skbuff: make skb_copy_and_csum_bits() report unreadable frags

skb_copy_and_csum_bits() now returns 0 or -EFAULT, hands the checksum
back through a pointer, and is marked __must_check. On error, the callers
in skb_segment(), the ICMP code, the IP append paths, sunvnet and sunrpc
take the failure paths they already have. skb_copy_and_csum_dev() returns
early without storing a checksum. With this change, software GSO of a
devmem TCP skb fails instead of silently replacing the payload with
zeroes.

Link: https://lore.kernel.org/all/179148235783.434549.14322374227477832817@kernel.org/

> Link: https://lore.kernel.org/all/179148235783.434549.14322374227477832817@kernel.org/
> Suggested-by: Mina Almasry <almasrymina@google.com>
> Reviewed-by: Mina Almasry <almasrymina@google.com>
> Assisted-by: LLM
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

[Severity: Medium]
This fixes the silent payload replacement in the !sg && !csum branch of
skb_segment(), but there is no Fixes: or Cc: stable tag.

The commit message says commit ab9414ed70bd ("net: skbuff: don't leave
stale bytes in skb_copy_and_csum_bits()") is what made the replacement
silent. That commit carries:

    Fixes: 65249feb6b3d ("net: add support for skbs with unreadable frags")
    Cc: stable@vger.kernel.org

Could stable trees take ab9414ed70bd without this patch? Devmem TX would
then send a zeroed payload under a valid TCP checksum, and the peer would
accept it.

Other patches in this series carry Fixes: tags, for example "net: skbuff:
reject a negative length in skb_copy_and_csum_bits()" and "net: skbuff:
check csum_start against len in skb_copy_and_csum_dev()".

Should this one also name ab9414ed70bd (or 65249feb6b3d) in a Fixes: tag
and Cc stable, so that both changes are backported together?

> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 93c2f440b9ec..a2b52a5a61a9 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c

[ ... ]

> @@ -4006,9 +4025,13 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
>  	skb_copy_from_linear_data(skb, to, csstart);
>  
>  	csum = 0;
> -	if (csstart != skb->len)
> -		csum = skb_copy_and_csum_bits(skb, csstart, to + csstart,
> -					      skb->len - csstart);
> +	/* On failure the rest of @to is zeroed; leave the checksum alone so
> +	 * the frame goes out with a bad one.
> +	 */
> +	if (csstart != skb->len &&
> +	    skb_copy_and_csum_bits(skb, csstart, to + csstart,
> +				   skb->len - csstart, &csum))
> +		return;

[Severity: Low]
Does this early return actually make the frame go out with a bad
checksum?

It skips the csum_fold() store, but nothing marks the checksum as invalid.
The sanity check earlier in skb_copy_and_csum_dev() only bounds csstart
by skb_headlen():

	if (unlikely(csstart < 0 || csstart > skb_headlen(skb) ||
		     (skb->ip_summed == CHECKSUM_PARTIAL &&
		      csstart + skb->csum_offset + sizeof(__sum16) >
		      skb->len))) {

For CHECKSUM_PARTIAL, the field at csstart + csum_offset can therefore sit
past the linear area. That puts it inside the region that
skb_copy_and_csum_bits() zero-fills on failure:

	if (!skb_frags_readable(skb)) {
		/* Don't hand the caller a buffer with stale bytes in it. */
		if (len > 0)
			memset(to, 0, len);
		return -EFAULT;
	}

For UDP over IPv4, a checksum of 0x0000 means "no checksum". Wouldn't the
receiver then accept the zeroed payload?

The same applies to a CHECKSUM_NONE UDP skb sent without a checksum. The
headers are copied intact, only the payload is zeroed, and nothing marks
the frame as bad.

The commit message makes the same claim:

    skb_copy_and_csum_dev() can't return an error, so it leaves the
    checksum alone and the frame goes out with a bad one.

None of the current callers (ep93xx_eth, ec_bhf, ksz884x, 8139too,
sc92031, via-rhine) sets netmem_tx. validate_xmit_unreadable_skb()
therefore drops unreadable skbs before they reach these drivers, and the
remaining failure case needs an skb whose lengths are inconsistent.

Should the comment and the commit message be narrowed? Alternatively,
this path could store a non-zero value at csstuff that is known not to
match, for CHECKSUM_PARTIAL. The code is unchanged at the end of the
series.

>  
>  	if (skb->ip_summed == CHECKSUM_PARTIAL) {
>  		long csstuff = csstart + skb->csum_offset;

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261019-b4-skbuff-bug-on-followups-v1-0-41dbef50b9f7%40toxicpanda.com
Technical Details
Message-ID: <179273111683.3134.7255247218847744918@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350903-linux-kernel-netdev=dewy.ru
References: <20261019-b4-skbuff-bug-on-followups-v1-1-41dbef50b9f7@toxicpanda.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-350903-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 01/15] net: skbuff: make skb_copy_and_csum_bits()
 report unreadable frags
Date: Fri, 23 Oct 2026 04:51:56 +0000
Organization: Usenet Network
Message-ID: <179273111683.3134.7255247218847744918@kernel.org>
References: <20261019-b4-skbuff-bug-on-followups-v1-1-41dbef50b9f7@toxicpanda.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="412060"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:K6C3H6L8SshdPwF84NuMERNV2wA= sha256:WtSHTDLBbQG/K8WnA9Zp+EHWD/eIfnfioKR+dQyu878=
	sha1:2BONFNcb60A/TliOggXz/V3sNb8= sha256:FhveGP6ssfR+DPm3Zc2EwIjwT7SCuodeRoyo1+lChrI=
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 63BAD1113DE; Fri, 23 Oct 2026 07:52:22 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.738
X-Spam-Status: No, score=-3.738 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, 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, URIBL_BLOCKED=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 lkKLwFsGOrDg;
	Fri, 23 Oct 2026 07:52:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-350903-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 CF0E61113B4; Fri, 23 Oct 2026 07:52:06 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 12B0F2D54F; Fri, 23 Oct 2026 04:52:01 +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=1792731120;
	b=R/NhXcXqOk1OSQtIsflX82iu868R/b1rrLesGxL2+92WRnjZGyR6zBz1dR7WMboMXErb
	 ynY2U6k88KJFQoGHbKuS8MF3vXZFnDAy6+omsiB7i01SJj8gK8XZMRbosPdS19GoFrASh
	 lpRANzTrIilTOrypNz1NVMe4pYqHB8FKaXaCHMy30kggCfYDT/fe0Gr0TsY/XG+bEqCJX
	 xW+1tZdm/8sMXNRx6fdM1z5T8R5CCmqi5HoS051qAKankiqsA41zULDWC43903IFU3pov
	 G6xMSCKVuNlMIZr3eQtfKkC1MZ6Uq/9oyo32uHoZuhPMWH5F+C56dLqc8SqqYUyz+1A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792731120;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=l5UCn3s3YyxcyE6vweegr4A1rPRcjt6h9F7KPsMd5KY=;
	b=udflWGemVYecejcdOZY/NWsWJaGcz8h3ONsQtEME8MfGnmR0mbBBtQgfM6Z5EobaitmM
	 ezUhpbTkA2p1sLvcLLfWiROFPWnfWdAZ9Zi/Es/CFBiUwbKrwK4LFSO1s9s1JpwIvp9jb
	 AUrynzIlPA+pz+3x2Nvmj87raP5ELn/AkJXnpcxjubGILR0gC8rLLFk16rhS+DEvREWWj
	 iSRIPGYZIea0+/ij4bxAP4ctlIgcrLcFEs6gSwmN7PDmWL4e1LVJrpmEtSoSbH8AhIJSK
	 PPUMuBh4iivovPjIFoELqUi98FPFBAdI3+y13BxNJzcwaTZI8vnEEOetCL44c8BzpiA==
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=g9IF7uFF;
	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 DF60C606A321;
	Fri, 23 Oct 2026 04:51:59 +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=g9IF7uFF
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=1792731119;
	b=kOtnys/rdhV3snT2wdupa6s3zcGunZOvuv11jSgTkRwqOGKVz6m9jAXehpJlPPR6Sn7r
	 4Ytvb8qJGbmMsE55wsjqRUYaVd7SSj7zQSMrG3fSZVzaQx4tphsUk3cG0lF6JHZmjZlnf
	 Yah/YXQN7Cv2CisD33WmpRYnDHNnruZPC3bvwzb5YSmOM727iFuYJbE94RjymNz/hexM5
	 wBjZ3z8s1YrncRe9YNnPplY6FcX3QOCpNnTVTePmEUmjKNoDu9iEXeSv08PGtYkrFqswe
	 QEq/Cjc116YaEartWxhurhV1UNgVT1CB23AobvBUj6qSsye4rgnafM5C0JS3XH2ZNQg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792731119;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=l5UCn3s3YyxcyE6vweegr4A1rPRcjt6h9F7KPsMd5KY=;
	b=mN2Tl2/UerD/XE57+IRxbuki6prRjkIGkhfnVMVHYEtJaa6emX07T+TT/9ZrJ++4J7hV
	 r2m8cIOhP+zF74LOpqJjepibu7CNfehnhnK6aAVVGNTxJ/JKjmgUADrg31I3W1HxYKb1w
	 6eHWqpVE9ppvBqHCwNWZ28ebJUJ/ETCA6xgLL/ECEJ73gCrrAxaHC/NtvvpgV3rT2DBT6
	 0mwhApkuFKsmD74Y7XH2/ITUYkGMCWmIfIemcKLquc5dmZ7DxALOSQPDTqQcrRoZorfNl
	 bhDfKLbct8f/Nbi86QP1O8BZW7zMqeUgFY+V8ZOqxt5FY9DG3+yWu0Hqlz975IA8LOg==
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=g9IF7uFF;
	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) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1A5A606A319
	for <netdev@vger.kernel.org>; Fri, 23 Oct 2026 04:51:58 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48EF11F01825;
	Fri, 23 Oct 2026 04:51:57 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792731118;
	bh=l5UCn3s3YyxcyE6vweegr4A1rPRcjt6h9F7KPsMd5KY=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=g9IF7uFF9+WPeewAagqf7C9jK+UL4Yc9xwbzrV2wTgTEZHIsI3StVz8RYNbRqLD1y
	 ZT/z/gtLR8fmAUx8n1LLfM+C9U2C0s0iAoOqTE2eIrLCwS710pc4j+WCR7k6JpEXBi
	 jybOBH0KSK6ReliEUHAaEcrL7hDF2YXHjUI3b52ci6q/qjWqiykJtkMTiqDnBskIDo
	 tq1A+WGsMnhTQ3RmAr3ikdjzDWGycUSMt0zu3QzuiWBdQVfcurM1AuhUjja3xFQAFw
	 abrc4XwH6LfzBGCKAbUY92A1FlhoYh3+SzUJX5SgFL6HeeykSWmDYZpB25LXRyy0ae
	 vW8LVJ3g00YTg==
X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
 pabeni@redhat.com, horms@kernel.org, andrew+netdev@lunn.ch, jgross@suse.com,
 sstabellini@kernel.org, willemdebruijn.kernel@gmail.com, fmancera@suse.de,
 almasrymina@google.com, david.laight.linux@gmail.com, netdev@vger.kernel.org,
 xen-devel@lists.xenproject.org
X-In-Reply-To:  <20261019-b4-skbuff-bug-on-followups-v1-1-41dbef50b9f7@toxicpanda.com>
X-sashiko-severity: Medium
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