🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7861

[PATCH net v2 0/5] net: fix misc signed overflows caused by bad sysctl values

#7861
From: Jiayuan Chen
Date: Tue, 27 Oct 2026 10:45
46 lines
11096 bytes
Recently I have reviewed quite a few fixes for variable overflows caused
by config values, i.e. a value set from sysctl, module params or netlink
that is accepted as valid but later overflows when it is used in a
calculation. I believe there are more of these still out there, so I
used an LLM to dig through the code and it found the issues fixed in
this series.

All of them have been reproduced and verified in QEMU.

v2:
 - gc_elasticity, mld_qrv, igmp_qrv: store the sysctl as u8 and use
   proc_dou8vec_minmax(), as suggested by Kuniyuki
 - docs: add the missing "Maximum: 255" to the mld_qrv and igmp_qrv
   entries in ip-sysctl.rst
 - message_cost: add proc_dointvec_jiffies_minmax() instead of a local
   handler, as Joel suggested
 - redirect_load: reject negative values as well
 - kept Fernando's Reviewed-by on gc_elasticity, mld_qrv and igmp_qrv:
   v2 narrows the storage type to u8, the fix itself is the same
v1: https://lore.kernel.org/netdev/20261023091419.167088-1-jiayuan.chen@linux.dev/

Jiayuan Chen (5):
  ipv6: restrict gc_elasticity to 31
  ipv4: fix shift-out-of-bounds in ip_rt_send_redirect()
  ipv6: restrict mld_qrv to 255
  ipv4: restrict igmp_qrv to 255
  net: restrict message_cost and message_burst to non-negative values

 Documentation/networking/ip-sysctl.rst        |  4 ++
 .../net_cachelines/netns_ipv4_sysctl.rst      |  2 +-
 include/linux/jiffies.h                       |  2 +
 include/net/ipv6.h                            |  2 +-
 include/net/netns/ipv4.h                      |  2 +-
 include/net/netns/ipv6.h                      |  2 +-
 kernel/time/jiffies.c                         | 40 +++++++++++++++++++
 net/core/sysctl_net_core.c                    |  6 ++-
 net/ipv4/route.c                              | 10 +++--
 net/ipv4/sysctl_net_ipv4.c                    |  4 +-
 net/ipv6/mcast.c                              |  2 +-
 net/ipv6/route.c                              |  7 +++-
 net/ipv6/sysctl_net_ipv6.c                    |  4 +-
 13 files changed, 70 insertions(+), 17 deletions(-)

-- 
2.43.0
Technical Details
Message-ID: <20261027104701.296240-1-jiayuan.chen@linux.dev>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352367-linux-kernel-netdev=dewy.ru

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-352367-linux-kernel-netdev=dewy.ru
From: jiayuan.chen@linux.dev (Jiayuan Chen)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 0/5] net: fix misc signed overflows caused by bad sysctl values
Date: Tue, 27 Oct 2026 18:45:28 +0800
Organization: Usenet Network
Message-ID: <20261027104701.296240-1-jiayuan.chen@linux.dev>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1516671"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:IPGleOqQEVUOoBBJTw2CwSvMOCg= sha256:XZ0FQq07LALjCjW2N1ZLvRarbZuWz2YMeCdlYqE1TjY=
	sha1:56ZXoDMOghJyjmDHINBivYkqYdM= sha256:lHtxTeYfp/8HilSO1qJsThERTTv9fAmXSiIRRdjsECk=
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 19A6B125BEB; Tue, 27 Oct 2026 13:55:17 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.05
X-Spam-Status: No, score=-2.05 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,
	HK_RANDOM_FROM=0.999, 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 (1024-bit key)
	header.d=linux.dev
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 4tX37nYKshGg;
	Tue, 27 Oct 2026 13:55:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-352367-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 1BF50125BEA; Tue, 27 Oct 2026 13:55:02 +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 814AC29ED2; Tue, 27 Oct 2026 10:48: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=1793098070;
	b=U7mdFDSZTNgIZFIDGvfR+ePv6RqKAbNuOPKLyBeVEcg06SU4to5ICGnef6QkPrGpSJB9
	 oduGsqpEjD31HZ/IqF98AABzULBL9MvIGvBUbT/ctfAEoScbs3K0sIgzjUeiq5Wtl+fc/
	 fv8mh0Wm31leua8CYKM8M3iMC5oyUwC6fyf10wiH83W+NdYJ/C+z3MilR6Jc8XVqF+BOy
	 tpbalTW6W4fRkWtHKbttqM5MY2Tn7/Am+Ba34pY+MlmxL9M90uK6zsGSGpRLYLX1GVsXD
	 cjkrbqbedMWSLzCNYFDJ/1qKCPAFBb14At+b/rOsU36ri0W2BQTJD7KhLYEcWfuNx3g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793098070;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow: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=qwOP/ChYXyQgeHq4JGO8UPM3SSS01nblW3EU8Z0OF+I=;
	b=E97BbW8LNNxQM5gHi+fR00jSg8ImJOMJNaSHNjMV87OCfQ4+OKYlzsryRp33QdulWPwV
	 ZMlL4mt6JolX1T6us5Di7oa/ifGnqJx82uuZFdBQnd6/wen42+muRpHTFIczi8Z2Of0N5
	 k3GKrWa978etmxBDGC5a6apnjOwFCXtyiRlcJ+RwAnCNwJgPj9yLEj7DJ+NiQlmJPuCvt
	 43YSJNcX3y0bSNu1Hekiir+eBeQE2dkfsr6+5HzILUQdcqWj4CVZHsN1BhMYMjyNlKQ9l
	 DefqwCoaRllJNLayW2E/3o9e1LTQVnNynIXDAigZbWh2e71eODuNWeFliKsh5ra+pKQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=qoEGlURb;
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	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 C11CF606A31F;
	Tue, 27 Oct 2026 10:47:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=qoEGlURb
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.105
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793098064;
	b=rIXpupNoeILILO2fVKUXZrgPYwIEORTH1cc+B8mICRoOfzjvTebrWXxuxKiwiUv4WYje
	 lj/ZJAEFPUTuO4m7plvkYdx1BVDo5NyMoIhd59GC10NIi1kJ3DMyliPswptIwmBJTz+ad
	 69yJexwExpPqmnBN3qlnejb1o72Etnyjmdo/nBsPtinrN9bnX85DFyFJvABTbmHPo9bU9
	 uUWRr57WerqIdVxdSnjjENu0QiaTA+1JJu7+LRFhWKkMFJnm/ImakTT2GCO7WUBd0BYXr
	 QwFCXE/haPxJzBOHJshmhFVeooohzhbbIAVrAZ2fgciKjfMHf9/4xEkfbGZBEmzkByA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793098064;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID:
	 X-Mailer:MIME-Version:Content-Transfer-Encoding;
	bh=qwOP/ChYXyQgeHq4JGO8UPM3SSS01nblW3EU8Z0OF+I=;
	b=MDD5gPMCV0jCXXYIKiaAjWk2Vq21VpoqjcWK2DuD3+9iKzGOCj6AWXm1vAem60mdAFi+
	 RhJ8jEgn35neLlUAzqJfyGsvi2SaHtlimNB7oU4xUu5p/NPwr8zMUVrroxexK2+ilSKVr
	 E7zXgLJbrGf9xvpXwWS6e5nMJWdFPfg4gPRjyC62nCEve1V3r1ograxGfkQqC8Xo9ISEx
	 A9N+bR1Dfr16yMCp1Ueh/UzLAf+Z1nNvJdo8IWZ7h4+ytSwonZB4llAYZjzlqt0Fq8gNd
	 Wf4rLolZh6wn+g3ZBoitctXTzik7GQBuaNaKoBFY64McWJIgxBD/V+3g7Z68RvxRrGQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=qoEGlURb;
	arc=none smtp.remote-ip=95.215.58.105
X-Received: from mta1.migadu.com (out-105.mta1.migadu.com [95.215.58.105])
	(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 BEED6606A323
	for <netdev@vger.kernel.org>; Tue, 27 Oct 2026 10:47:43 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BEED6606A323
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev
X-Envelope-To: netdev@vger.kernel.org
X-DKIM-Signature: a=rsa-sha256; bh=p/T42mWw683F+K90Gg/h7jvsPmk0ttOQkRNGpJzra0I=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1793098061; v=1; x=1793702861;
 b=qoEGlURbgPBtgeAvcYsj0jADbzPC1Tj+xt69JAtJOkj9nfUK+lpSkzId36Ln+ZJs6d7/ZGH6
 mbELWaVN5ywpAwp6MOzO8fi5VPrF6yK/RcVjXbneNX3OvxPrYrViwXjF+6euM2slJI+IXn2VeZg
 1Jssey2e1JUeeNhxhQ7cWL9Y=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by smtp.migadu.com with ESMTPS id 4f2ce23dc9097964;
	Tue, 27 Oct 2026 10:47:41 +0000
X-Mizu-Trace-ID: 4f2ce23dc9097964
X-Migadu-Flow: FLOW_OUT
X-Cc: Jiayuan Chen <jiayuan.chen@linux.dev>,
	"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>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	Joel Granados <joel.granados@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>,
	Petr Pavlu <petr.pavlu@suse.com>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	Fernando Fernandez Mancera <fmancera@suse.de>,
	Willem de Bruijn <willemb@google.com>,
	Maoyi Xie <maoyi.xie@ntu.edu.sg>,
	Zhan Xusheng <zhanxusheng1024@gmail.com>,
	Jiri Wiesner <jwiesner@suse.de>,
	Oleg Nesterov <oleg@redhat.com>,
	Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>,
	Yung Chih Su <yuuchihsu@gmail.com>,
	Wyatt Feng <bronzed_45_vested@icloud.com>,
	Flavio Leitner <fbl@redhat.com>,
	Hannes Frederic Sowa <hannes@stressinduktion.org>,
	Petr Mladek <pmladek@suse.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.43.0
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