🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17383

Re: [PATCH net] net/sched: act_csum: bound the IPv6 jumbo payload length

#17383
From: Piyus Kedia
Date: Mon, 16 Nov 2026 18:21
85 lines
14100 bytes
> Could the changelog say that TCP and ICMP csum configurations (for
> example "action csum tcp") were also exposed to a bounded over-read? As
> written, it reads as if only TCA_CSUM_UPDATE_FLAG_UDPLITE setups were
> affected.

You are right.  v2 follows this mail with the changelog corrected.  v1
claimed those handlers were "protected by accident" because csum_partial()
takes an int; that is true only of the kernel it was tested on, and I
should have checked why.

The reason is worth putting in the changelog, because it is also why a
KASAN fuzzer cannot find those three paths.  On x86 there are two
implementations of csum_partial() and the configuration chooses between
them:

  arch/x86/Kconfig
	config GENERIC_CSUM
		bool
		default y if KMSAN || KASAN

  arch/x86/lib/Makefile
	ifneq ($(CONFIG_GENERIC_CSUM),y)
	        lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
	endif

  lib/Makefile
	obj-$(CONFIG_GENERIC_CSUM) += checksum.o

So a kernel with KASAN gets lib/checksum.c, whose do_csum() opens with

	if (len <= 0)
		goto out;

and a negative length reads nothing.  A kernel without KASAN - which is
to say a production kernel - gets arch/x86/lib/csum-partial_64.c, which
has no such test and dispatches like this:

	if (likely(len >= 80)) { ... }   /* signed, false when negative */
	if (len >= 40) { ... }           /* signed, false */
	if (len & 32) { ... }            /* bitwise, runs */
	if (len & 16) { ... }
	if (len & 8)  { ... }
	if (len & 7)  { ... }

The first two tests are signed comparisons and the last four are bitwise,
so a negative length reads whatever its low six bits say, up to
32+16+8+7 = 63 bytes.  Your example confirms it exactly: len = -70 is
0xFFFFFFBA, low byte 1011 1010, so the 32, 16, 8 and 2 blocks run and 58
bytes are summed from the transport header.

That is why the KASAN report in the changelog names lib/checksum.c:119
rather than the x86_64 file, and why only the UDP-Lite arm showed up: on
the kernel that found this, the other three paths genuinely did read
nothing, because enabling the sanitiser had replaced the implementation
that would have over-read.  The over-read on tcf_csum_ipv6_tcp(),
tcf_csum_ipv6_icmp() and the ul == 0 arm of tcf_csum_ipv6_udp() is real,
it is bounded at 63 bytes rather than 65535, and it is invisible to the
tool that would normally catch it.

This is a new posting rather than a reply in the old thread, so here is
the context.  v1 and the review being answered:

  https://lore.kernel.org/r/20261112075445.3555341-1-piyus@iiitd.ac.in

and the [BUG] report, with the original KASAN trace and the reproduction
conditions, which went out as its own thread - not threaded with v1, which
is my fault:

  https://lore.kernel.org/r/20261112075159.3552470-1-piyus@iiitd.ac.in

I checked your arithmetic and the three call sites before writing this,
on net-next: act_csum.c:245, :196 and :343 respectively, each reached
with the negative value behind only the wrapping pskb_may_pull() in
tcf_csum_skb_nextlayer().

The code change is unchanged in v2 - as you say, bounding *pl in
tcf_csum_ipv6_hopopts() closes all four paths, so the diff is byte-for-byte
the same.  Only the changelog grows: it now says that TCP, ICMP and the
ul == 0 UDP-Lite arm were exposed to a bounded over-read of up to 63 bytes
on kernels without KASAN, and that the 65535-byte read is the UDP-Lite case
specifically.

Thank you for the review - the KASAN-swaps-the-implementation part is
something I would not have gone looking for.
Technical Details
Message-ID: <20261116182108.2581258-1-piyus@iiitd.ac.in>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364622-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364622-linux-kernel-netdev=dewy.ru
From: piyus@iiitd.ac.in (Piyus Kedia)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net/sched: act_csum: bound the IPv6 jumbo payload length
Date: Mon, 16 Nov 2026 23:51:07 +0530
Organization: Usenet Network
Message-ID: <20261116182108.2581258-1-piyus@iiitd.ac.in>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2135224"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:TILtHvu/6uDoIKO81Hwfvu5QX5k= sha256:+4JAjwjl+tXXDojdjTFAA4KCIIyJomvSvCmPGxiIylc=
	sha1:5lDi9mzUMJbnS8uNXTsEs1+qDaU= sha256:FE0AwVLDDKaSWNWVROHDXuseJHjLMfaqnx96pqwP/Vk=
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 86B9C114D26; Mon, 16 Nov 2026 21:21:49 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.751
X-Spam-Status: No, score=-2.751 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=0.1,
	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=neutral
	reason="invalid (public key: DNS error: query timed out)"
	header.d=iiitd.ac.in
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 zvSsTeFBNLRS;
	Mon, 16 Nov 2026 21:21:38 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-364622-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=iiitd.ac.in
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 54D1D114D1C; Mon, 16 Nov 2026 21:21:24 +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 DA2972A99E; Mon, 16 Nov 2026 18:21:22 +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=1794853280;
	b=YMqWXqNWbzoFX2Ymr8OsUMOcYZ/I+lyVH/VxdVweRvWSKrvU802JWIp3N2HfOJqpwGh1
	 MxD5tsBa8/57h8dfqZEi+5Xu5VmeJiiGfsvvNJBEvrF2aLod8UZ1unVuu/V0xAZWZVXyu
	 lYdIem+wamEkI0QIGiPpVFvCjfWY4qTocymNy9DqT2W4BCIYmPEAgLP07u+gYUpXwmyro
	 yVe5q/HJiixuQpmNj7MIgeYWdnkmYZcT6DSGQV1bC4rfovUVQkfhlTuFVRoHKWqVoBt8X
	 8GF54U7++3gNcSbKkycr0YFQMyXgqGexnrjI1Z1YWFmI4NA3lZvv4tDrFZcTCucOjyA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794853280;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-Id:
	 X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=WLbvZZUrSw5V3WK97DepXaH190SbFLxLhAaVVJSONIc=;
	b=k/96myEYshqgGY8Do8Iuw/sb3wJnAvROsnut3DhYF/oW9RJCwr2Mksc24D02LvQkbcjg
	 O4pF8VOYTlouLqp4lASnGOzezR5JYHioJ+FluNXr7903mjkL3C1S4BZSImoP2zuPF+YCt
	 iy2vMiQ2IYlGpdtsA/9XBBKk6P6pM4ZGuF0tqF4dIXeYud7ha2Kwy2GITKvZPz1zCs34V
	 Gsrd7kavWA3uyD74hPS72HZtQ1bMoluXJBl+ajJhLC6fIzJ8l+ZyOAoLSTsilNzEP1iRj
	 DZxlwTYpliF+j/1jZjKfXA1GI07tA4N1zdNKr6cPDEtvmByhQ6l9NTuoaVI0N84n8gA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=iiitd.ac.in header.i=@iiitd.ac.in header.a=rsa-sha256 header.s=google header.b=cOyjGNXD;
	dmarc=none header.from=iiitd.ac.in;
	spf=pass smtp.mailfrom=iiitd.ac.in;
	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 A13D9606A881;
	Mon, 16 Nov 2026 18:21:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=iiitd.ac.in header.i=@iiitd.ac.in header.a=rsa-sha256 header.s=google header.b=cOyjGNXD
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.174
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794853279;
	b=OD/5n0YmrAq46Uovap/b3+eXAdJvMwL4JHMWbde33tnY9oeFVmJXs204GWMIDECVj0F4
	 qr+F1RxkdToUN7ZbkV8g3w3GTYBWsbCYTjS78SOHgleYPTYp18iqJRoq9CWGCryKG6pIo
	 4SinjYnq0HaDylEqyTmgrpHYDiUzmBdRva+ngcsr516v2LpJXhfN9QvulkByEb4nvOrTK
	 efCjYy4qFFItxHGQwDpRy3ZsCy12+hQXfSTifOLh9RSrX5DNXcyYxG1aA6iUtyxRlbBUK
	 +Z/nDB/S9VGU777ttpWf6GzWXg0ory6QQKPXBFQUPi+wZ88cnqP4Zj8JTHTrk6G0gxg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794853279;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 From:To:Cc:Subject:Date:Message-Id:X-Mailer:MIME-Version:
	 Content-Transfer-Encoding;
	bh=WLbvZZUrSw5V3WK97DepXaH190SbFLxLhAaVVJSONIc=;
	b=hlcimxZGMwGu2uBLJqsTRlK6fyC1GkPMI6skVm3IlUKU0d/vZTvtt1c3mJmTOMiT8IF6
	 sJG9f9JnxtjCr+jsOcLcUcEF7EKUWkuQbdVN2KGbD2Ho6AbkMqT+Cf1Crux7NelX0LHWu
	 QLpBr+/IZmZg8RGyaDMTdAbtsmdMxRsOWkTbxXCcRx2KSfyk2SLh295ziarRNGqGq/pNq
	 GxFVr0zGFGF72EMwkHvK3t63MuBqgEh44Tt3DiwOCFLUaqwPmsvv8ULqFPLpwtaLYLedT
	 OCtQVAxPeiVzlYqE3pQbPcXe1fQ7WiE8f6n+SIjXEu/FTlYUMPdIu2e2qonza5spGQA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=iiitd.ac.in;
	spf=pass smtp.mailfrom=iiitd.ac.in;
	dkim=pass header.d=iiitd.ac.in header.i=@iiitd.ac.in header.a=rsa-sha256 header.s=google header.b=cOyjGNXD;
	arc=none smtp.remote-ip=209.85.215.174
X-Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174])
	(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 6BA07606A322
	for <netdev@vger.kernel.org>; Mon, 16 Nov 2026 18:21:18 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6BA07606A322
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iiitd.ac.in
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iiitd.ac.in
X-Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-cdb1199bfd8so1557090a12.1
        for <netdev@vger.kernel.org>; Mon, 16 Nov 2026 10:21:18 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=iiitd.ac.in; s=google; t=1794853278; x=1795458078; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=WLbvZZUrSw5V3WK97DepXaH190SbFLxLhAaVVJSONIc=;
        b=cOyjGNXDLvqhDwt91E88cBd0axkpasya+Ob+OHfe5h39cjLZJ4zGpsY7vx1ZUURo1r
         Ii4etqcM2pfsQzYCgWGhfa1BalVu2jk4Qy7XMre8BYtwhjIYPx7CpvfsLUgJTFJU4rgF
         7x7ROfBVWpaALa2PG31G3YKQohwmdZZFz+tWs=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794853278; x=1795458078;
        h=content-transfer-encoding:mime-version: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=WLbvZZUrSw5V3WK97DepXaH190SbFLxLhAaVVJSONIc=;
        b=gBRMlv8uz/NPudVKjIPIvyOUGL48JetQGMOV8fqsBvzJYEpMoz2O5JQcDQQESXBaSt
         HU2NnnUdxrkn4UqwFtGW83BcA+O0S29tbJfW3rJ01tLM08isIXN/XInZwQlu9CiR3KVj
         aJoleeEOSDb00EtTZCjWKDq9SxlbbTHv6rjyLbi/xMfcFuJtHxP3YpKhHZCmNEgCI/Zl
         TuwDkTbaNznwMV0v8+koXPgB4whOelbG2xtPD8HUlekbNQiJKl0GmJbLKbLwHFTU722+
         xh075rQmBV5Lw3lmaPYCnkpMBmylijyWPmwrOuWBhBMmUY6V/H7EijrjFZV5nBiobG6w
         ecmQ==
X-Forwarded-Encrypted: i=1; AL+hErEuu5qpJZChvcwSNFGZkxp1RIOPHHMjRSdGo5iWyp9qYycfeuO/ENkNyxHPml3TlbgsCvFgoVE=@vger.kernel.org
X-Gm-Message-State: APuU4Z8asSrnG1w2gBrAcBECeCjOmRAf1iMJNbD0AVBVnfBsqZl0L3j2
	+qHgzbY3lAabeorZ/MG5E9QeSpX/pf0NWuSHd2J6lk/fR980YuXkFtIccclM65qrijE=
X-Gm-Gg: AZFdTZcFyfLSg0130RpbkIKR4g7SYB+WsU0e4JEQtS7FYU1okHRllmS+hM262UINteN
	sa6MohIjEMT6MX3IgUc3ypE0zTYPfgjimSQwEJLYmaxIncAtP1vcrSVbD5bAWptLbq3qIFHI6hj
	4ViVkoXAKwi3lYofh21sc6B9fyOgPBS94MM8titvP8dJfy+iJ+3NPVOhuTq8ZWzN6GQIot/B29g
	NP4LLxRGgiFjc8ixS16LLIRNtBK8K+KQ4zNNubwFjkQ+WWLIEJb4QKMpzzhWr5FHy6fhAob7NqQ
	NxyT71LrEW6MUCzd2d39HliiQvvlKNY93xxO+9qV4oZZGT56n2axT0Tp3wJbQUv+OQZ6XL+tzNe
	nBF0g05gmj8gu4CRZ/P4G2nha5B6hWQ1Q/aNPGfIfymXJgXCgwIx/80Hvu9N98HY0chyz0LtLnR
	Jj4IwWCKSDpLOJdnwV0oNoqVVfo8Dgah2cM1U4KROncv0DHvA14zoFgYMcURL3PaAqchVOUUXtT
	S155vSLp3WclrEq2ZLdjH7w4oKRAxike/mgzVeXlYDt4YMoWm/W5xzqSMp2CD5H3VY/IxjlXZcp
	JM927VM/UeUivoMPvYTYW4Chc9ueUitu+XJrXy8qwzmgLpMJD4jnE0JZPyiw67tXyY0xoq4669G
	v24tAsITDE2ZFG5gMcCl27eRxfIQ94/DUlyOCZEkfGCBL3+xHQp0OkKqZ6z8H4skJ
X-Received: by 2002:a17:90a:e710:b0:3a8:92a3:8baa with SMTP id 98e67ed59e1d1-3b1b0a428b8mr9583988a91.27.1794853277539;
        Mon, 16 Nov 2026 10:21:17 -0800 (PST)
X-Received: from iiitd-S2600STB.iiitd.edu.in ([103.25.231.160])
        by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b3ac2b5ec6sm312798a91.10.2026.11.16.10.21.12
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Mon, 16 Nov 2026 10:21:15 -0800 (PST)
X-Cc: davem@davemloft.net,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	linux-kernel@vger.kernel.org,
	Kapil Vaswani <kapil@presceralabs.ai>
X-Mailer: git-send-email 2.34.1
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