🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #2861

Re: [PATCH net] net: skbuff: don't segment unreadable skbs without SG

#2861
From: Josef Bacik
Date: Tue, 13 Oct 2026 17:58
39 lines
10044 bytes
On Sat, Oct 10, 2026 at 01:33:14PM +0000, netdev-bot+sashiko@kernel.org wrote:
> Does this guard also need to cover the sg && !csum case?
>
> The commit message says:
>
>   "and with only checksum offload off the segments keep sharing
>   the frags."

The segments do keep sharing the frags in that case, so this bug, the
payload being replaced with zeroes, doesn't happen there.  The commit
message shouldn't have implied the case is fine though.

> The devmem MSG_ZEROCOPY path in tcp_sendmsg_locked() goes through
> skb_zerocopy_iter_stream() and never sets SKBFL_SHARED_FRAG. As far as I
> can tell, only the MSG_SPLICE_PAGES branch sets it. That means the
> __skb_linearize() fallback is skipped and skb_checksum() is called on an
> nskb whose payload is entirely in unreadable frags.

With SG on and checksum offload off, skb_segment() calls
skb_checksum() on each segment, and skb_checksum() can't report
failure, so on unreadable frags it WARNs and returns 0 and the segment
goes out with a checksum that doesn't cover the payload.  That's been
there since 65249feb6b3d ("net: add support for skbs with unreadable
frags").

> Would checking !sg || !csum here be more appropriate?

v2 drops this check.  Mina asked for skb_copy_and_csum_bits() to
report the error itself instead, so v2 changes it to return -EFAULT on
unreadable frags and every caller handles that, skb_segment() included.
The commit message there only describes the case with both SG and
checksum offload off.  The sg && !csum case needs skb_checksum() to
report failure the same way, and I'll do that as a separate fix.

pw-bot: cr

Thanks,
Josef
Technical Details
Message-ID: <179191432558777.2.414389277062940952@toxicpanda.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345786-linux-kernel-netdev=dewy.ru
References: <20261009-b4-skb-segment-nosg-unreadable-v1-1-7e2334a55fe8@toxicpanda.com> <179163919450.434549.9325877615055483977@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345786-linux-kernel-netdev=dewy.ru
From: josef@toxicpanda.com (Josef Bacik)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net: skbuff: don't segment unreadable skbs without
 SG
Date: Tue, 13 Oct 2026 17:58:45 +0000
Organization: Usenet Network
Message-ID: <179191432558777.2.414389277062940952@toxicpanda.com>
References: <20261009-b4-skb-segment-nosg-unreadable-v1-1-7e2334a55fe8@toxicpanda.com>
 <179163919450.434549.9325877615055483977@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2119535"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:N6gdcGR0eP5eRR/2hCPF+aAmWko= sha256:8+YXdoIkh2aNU6+j0wVbg9dlGgooxvqAwBcJ1vFgXM8=
	sha1:LZs3pRMCCEu1GlJ39gX95QR+hRc= sha256:vnm1B9OiqLktSd0YhnJ7mprErnEA2ZgH5Zet1tHIPTQ=
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 EAE2210FEBB; Tue, 13 Oct 2026 21:12:10 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.75
X-Spam-Status: No, score=-0.75 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	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=toxicpanda.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 hSpPKykCxTac;
	Tue, 13 Oct 2026 21:12:04 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-345786-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=toxicpanda.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id D801510FEB6; Tue, 13 Oct 2026 21:11:55 +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 7FF54165EF0; Tue, 13 Oct 2026 18:01:03 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id AC504480348;
	Tue, 13 Oct 2026 17:59:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=toxicpanda.com header.i=@toxicpanda.com header.b="i+nr1hx1"
X-Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B2555326A9
	for <netdev@vger.kernel.org>; Tue, 13 Oct 2026 17:59:42 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.181
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791914384; cv=none; b=EgKfN5CsQAAvvYOqfDWO+ZgDqqrywj3n2qLTu3hxU/wSIkd8/+qOkGwLl9oeOchC29cK5gqlUFYi3JHa+9WeBmsQ2ktHuZC0Ze2UCfnECFCfEJ2/yDRaYQeKOAKXFp4DDO/GRZ8pag1QLMISatRgI+9exQTc5I3QiqsUdiUVClg=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791914384; c=relaxed/simple;
	bh=tJra5WXUJUAErMt026HVIKG9BLHea906af/cVQLm8tw=;
	h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version:Content-Type; b=a1GlJ4ior2wiN7Rzz5AbmQhR7lsapbdceiIxoDChO/0B7+sVykzct0ttubU2yVstTiKED8QfxVhHYSetJrco9h8fvZv1t32tj+tfF1eGbVyop/Op7/bKmrtl4qktZcaLljR3/QBdA5V2JPnJW8XUOJCcx/3ARU6nCDiqZNMCqzc=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=pass smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda.com header.i=@toxicpanda.com header.b=i+nr1hx1; arc=none smtp.client-ip=209.85.222.181
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toxicpanda.com
X-Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-93ef1a2948dso172484585a.3
        for <netdev@vger.kernel.org>; Tue, 13 Oct 2026 10:59:42 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=toxicpanda.com; s=google; t=1791914382; x=1792519182; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:mime-version:references
         :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=I7PYK2NFBnnrBKq5En7ZMWWtpUU9RPTiFiLhdaDzGE0=;
        b=i+nr1hx1jUqGqLAJHMSKKDOI2nVJS2NqWUt624pJ/sUN0URhOZFLoWVA2iI1oMKVl3
         /mGQ3tRjJiMD3qaK2ftzqtjASF9hLj3xbGL2hMst2I9H5d+OVZFnzN+uz5CH7IK3NUjy
         c+PEnt2Zd8tWl13kqRoqXXK6ho4mL0ZrErLJGYhUYAEugShty2NpAl1UoZxnLm7SZP6o
         7mB32ty3hsaA6bdaGKoOCeP0GQHvefHZ45noD2b3RHB2JtORgCoOip7t9lCV6zai3cBT
         5vP1nB3vDfPNdTeHnZE/fagvvX5zVzu0MEM19ftCo/CdrABiqUdvwAJrWJBPDCTCGV7z
         EJPg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1791914382; x=1792519182;
        h=content-transfer-encoding:content-type:mime-version:references
         :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=I7PYK2NFBnnrBKq5En7ZMWWtpUU9RPTiFiLhdaDzGE0=;
        b=1ylIPb+8QqqmP9lyPnAgu/UNfmS2sz1rwyrDVfh+PZUoM4uP7NS5o6X8livD3NpaMZ
         Y8jHsslDeXAqSHzbB6rMolePKjuA1oPy6iI9gRnToCjdcGUCZDThVuimQ7+cvg1N6+F5
         XXweZs38f1oWE6c6oSww+kbifDzlKz1JTisl9OX5FSoY6sLvMZZLoAT0H+M9o8EoqEcB
         irEMfeUHFdNkuEeILKQ3thtIvwzpppUpEHJ1PVyOg6C9h+hAFlLVC0oBremFbkV0UgBp
         +Vs5AWoe8w+GkdRHLEn84y+EYMHLgD9NroaDY/7MSqv0WKeySUEfkruL0hK9QehWohj4
         PtSw==
X-Forwarded-Encrypted: i=1; AKwUvBzf/zdiGCj0Ep0oNVsov4ONnzbEs+EN97ejM8beZiFmcrrfwUI4pkIDi9sA7pBh3wZBXHfHa3I=@vger.kernel.org
X-Gm-Message-State: AFq9FYIBQinaJoBY9cabbtBhqET/Jpy7nDdrQGBLhvlP2midJ82oXkrc
	BE9czdfIFKk8Th1HvXuxZTUJE1ye1x9YM9i7+ISkjTnHOeQsn9fKHGaLwBaLaDxKmNI=
X-Gm-Gg: AYBFou06DCZPYSB4Djx3MkH6xTBAQ4e3Xz9dlJCmW+Wyd6TvIEnl4Z5VeIjTePccIVP
	d0hw+r/geX23xYXnl4bZGRqcQQdWPoER1IMuqQOe+jg03FZT1s0D69zf4ozwbA8xrQ3ivZtn0jb
	MvxWjcdN0ebj2IpoOjYwzjbuWLgIc9baGWPk8cNE1W4WhuxaFwticUpXt9VxQNsrNcg+F9OQluE
	zXkUKozLO+mant8oYMJ2WIreHWV0K9rFXA1NuCxphnvVz7vlLwvZd+SlC/qGJ3KgibpAvNtsmVX
	QNQ0yFPgK7dgrCgutXjXYV8AXKXGux/32WjZtZE+spg7UQQ3bhxj7ymiuUUWs60K4LjEz1se8xb
	U4R9pDpiEgihh6x401rSqwAc8BKwL5MfgbtPVXSdbGK+kJwD18rf2xBSXd63xCSDvjP7fSN4uZH
	ATrswlvEvjBq4uvZZ8q9FOBq5FSH2uPcUTOieN78LaddbYn7UrjtEgneldM+3Ckexnm+g1DxHL/
	yzgOt7V1x9Gc5s=
X-Received: by 2002:a05:620a:6405:b0:93d:e031:5ad with SMTP id af79cd13be357-93ebd224911mr2124184885a.17.1791914380656;
        Tue, 13 Oct 2026 10:59:40 -0700 (PDT)
X-Received: from toxicpanda.com ([153.61.196.248])
        by smtp.gmail.com with ESMTPSA id af79cd13be357-93ef5086fe3sm292732185a.37.2026.10.13.10.59.39
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 13 Oct 2026 10:59:39 -0700 (PDT)
X-Cc: "David S. Miller" <davem@davemloft.net>,
 Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
 Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
 Mina Almasry <almasrymina@google.com>,
 Willem de Bruijn <willemb@google.com>, Kaiyuan Zhang <kaiyuanz@google.com>,
 netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
 stable@vger.kernel.org
X-In-Reply-To: <179163919450.434549.9325877615055483977@kernel.org>
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>