Article View: linux.kernel.netdev
Article #7476Re: [PATCH net 1/5] ipv6: restrict gc_elasticity to 31
From: netdev-bot+sashiko
Date: Mon, 26 Oct 2026 12:15
Date: Mon, 26 Oct 2026 12:15
70 lines
10400 bytes
10400 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message for "ipv6: restrict gc_elasticity to 31" says
only "Cap it at 31", and its reasoning covers only values >= 32.
--
ipv6: restrict gc_elasticity to 31
This commit switches the net.ipv6.route.gc_elasticity sysctl from
proc_dointvec to proc_dointvec_minmax with bounds [0, 31]. The upper bound
avoids an out-of-bounds shift of the u32 ip6_rt_gc_expire in ip6_dst_gc()
that UBSAN reported.
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 94e5ef1c4f83e..6f2efc219f395 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
[ ... ]
> @@ -6627,7 +6629,9 @@ static const struct ctl_table ipv6_route_table_template[] = {
> .data = &init_net.ipv6.sysctl.ip6_rt_gc_elasticity,
> .maxlen = sizeof(int),
> .mode = 0644,
> - .proc_handler = proc_dointvec,
> + .proc_handler = proc_dointvec_minmax,
> + .extra1 = SYSCTL_ZERO,
[Severity: Low]
This isn't a bug, but should the commit message mention the new lower
bound too?
The changelog says:
Cap it at 31. 31 and 32 are equivalent anyway [ ... ]
Values above 31 add no new behaviour, they only hit the UB.
This only covers values >= 32. With extra1 set to SYSCTL_ZERO, negative
writes that proc_dointvec used to accept will now fail as well.
The lower bound also fixes real UB. In ip6_dst_gc(), rt_elasticity is a
signed int read from the sysctl:
int rt_elasticity = READ_ONCE(net->ipv6.sysctl.ip6_rt_gc_elasticity);
[ ... ]
atomic_set(&net->ipv6.ip6_rt_gc_expire, val - (val >> rt_elasticity));
so a negative value also gives a negative shift count.
"Cap" also reads as if values get clamped. proc_dointvec_minmax actually
rejects writes outside [0, 31] with -EINVAL.
Since this is tagged for stable, could the changelog say that writes
outside [0, 31] are now rejected in both directions? That would help
anyone with a negative or >= 32 value in sysctl.conf who starts seeing
the write fail.
> + .extra2 = &ip6_rt_gc_elasticity_max,
> },
> {
> .procname = "mtu_expires",
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261023091419.167088-1-jiayuan.chen%40linux.dev
Technical Details
Message-ID:
<179301693822.3134.16821045137329382001@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-351878-linux-kernel-netdev=dewy.ruReferences:
<20261023091419.167088-2-jiayuan.chen@linux.dev>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-351878-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 1/5] ipv6: restrict gc_elasticity to 31 Date: Mon, 26 Oct 2026 12:15:38 +0000 Organization: Usenet Network Message-ID: <179301693822.3134.16821045137329382001@kernel.org> References: <20261023091419.167088-2-jiayuan.chen@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1302606"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Q/r7zOjJKjqfJLE0cb0yRxAjvkE= sha256:IXG9x4CywcWvxT22TylX51BTue4x0ZUfTmfB++TJ6tA= sha1:Y4ifjzJnm5F1bCE7bmxnxcR76cE= sha256:6TOh3LyzzdCvOZ7kTkM4/nHZznCUe57W1LTB4KoFPow= 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 B45B3125B99; Mon, 26 Oct 2026 15:20:54 +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 jEDfmk1FL9uT; Mon, 26 Oct 2026 15:20:51 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-351878-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id D9923125BA0; Mon, 26 Oct 2026 15:20:42 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id A5C102B140; Mon, 26 Oct 2026 12:15:41 +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=1793016941; b=RQo7LOZEJnPK/0mAmNVncdUKb9mYbnZaKhdeaE/st9WEpgZrS03tqVVE3ICXAy6bxCH8 PkTqOYR8LE17YZ3An7phTZj3290vc6ImcknwyPAr3KnSkAXS8MMYGOqasjNE7Z0I4JTzp Q7NcmbYEVr83X0h53ZbsdWpDtbCvYwe0UIpfodZnaG5ncOceQ/p9ev14FK73zl3/VbP0Q Aie9sR70EL6UnwptXXRlx909la3Mgpwig3XyN78VeLxfHsxttWSYfUGLxAZ/57FXbL/ue 3PYapiYWhOcmHF2VM9x9TgcRsla+bANrdDoKMtUtOyaqygIUK8unSsp3X/p+1KrEJJw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793016941; 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=H8KnQWvxuK6V08t47ps2cs08V3cGZwetRofByIjuEao=; b=2qH64L+s4eoIPKjAuLpdSQknZ2ouurbhsOf2zkEKj4iiuUvPuqZDbMHIcOdX9XfP04O1 jz2ylbSRDKUJD/Te6wQ4zv7+oynWEbvLmFN4nFpYYVxl8GV13JuK3VlPR5h9bPJo4jnMg 3jLLbT6l9rLZ+iNIPZXyHbEBuAtRfR3qwZqfJQwZiVF+Gg6FoUG4leUt1j80mCuJeleJu Db7N33sE7bdKWZR+jiHeriW+Su0POu8muhdG3C4ad1hY9y07f62yX8Qan1YP+lVeIyOKn 1a07km2NKKaycNuVYtsHBE0P7rxo36m4PLbfTTyhtvnbR918NU5fAzLv/tJ8KcxFSkA== 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=UcZ+UzZh; 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 26EB3606A320; Mon, 26 Oct 2026 12:15:41 +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=UcZ+UzZh 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=1793016940; b=L4hVw0lwcC2DOPlE+3yYDOuAR2pIloEnSSnytVOSdt9h3xrvfeq7KNJ2BQuZuwaIqJFD JrDhpgLi4Vt4tktkdFWAPIRDwFRPUmWv5misgOjc6jX02jC7jlG8B0/9OuiNXxLAA2/JS 8uS0vVrDZ6nGNJY6mynsfuhOOLMi7+9Fl7QdobkAxwFJ0+zMl7NdB/ZyzhL4p3hVt5Sfu NAQwpV0dAU76ifUdrC5XywlJEhEOH43i995wmDaEhnfAuZchTxsvM0Q53xlZeO+Xx2uyF HejoEYjE4ESU1ERQqy+6ca8PqmI/Qlavk6+mgBSuTdxnQ/dkjBp+npyVLzVm/MCZYoA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793016940; 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=H8KnQWvxuK6V08t47ps2cs08V3cGZwetRofByIjuEao=; b=l9Ra475RgTXRk6D49ENBBs0B3z8/N3pEYLYumGzGYKMxwftQ7OlKe8eAJbc+vR3jurUp OHZ3bgLKp7eZFcm7zh3ulO5K9PeiyNY+8vezu9+Dsxbf4KqQIQGCw/UQ6R6di8jNSSfav yQhE6T2yVjg976+WOExO4+99EpTN44t4krHLgXbZzkDGHTr/wG/Zo94Ju9T6Zl2hx7Lqn avc6Tgsotg8kuWYvT6Iy3v700evucXXbpohQCdNXi827UYVKjKgXExSrw6SNjonA73sKa X0n4vEEdSsPASlMOBQlcNAHdRI6FM7bSzeWDrJZfiGBm3ADUlHqnwcQWdyfTEfn9wkQ== 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=UcZ+UzZh; 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)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F17C2606A321; Mon, 26 Oct 2026 12:15:39 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A04961F01825; Mon, 26 Oct 2026 12:15:38 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793016939; bh=H8KnQWvxuK6V08t47ps2cs08V3cGZwetRofByIjuEao=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=UcZ+UzZh6envg0pIT6DV3Crs77mjh+wm0SzypbOqgqTc3or4MLJtFN5lhp8Uzq4BA 3s/VSsEJeN2tQF+AtS+f209Rqn7xqJR3LNj6S8U1CXmZdA5C1Q7bhDRuqaB0QBNe3h 6+gMbTFWeoCUMUtXOHOqDOUCs/f4+EeCD+dsjpecxOVev4K6UG4Xu+jaW9AFXRW/Fi CBC8PufITzQsUvyQW/WXyO/5VBkwDZRR9cZDuET4Nc6ueVcqxn5f2O9dik6qV10mRB yEgCPYGFMIRBF47ZKXsnxb00HMID1A3aQEfIu2k9TzfXL/PV9V0A9R/pRP3ie8hzbk 5D/LB80BoUj0A== X-Cc: netdev@vger.kernel.org, stable@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, dsahern@kernel.org, idosch@nvidia.com, kuniyu@google.com, joel.granados@kernel.org, chia-yu.chang@nokia-bell-labs.com, bronzed_45_vested@icloud.com, yuuchihsu@gmail.com, fmancera@suse.de, hannes@stressinduktion.org, fbl@redhat.com, pmladek@suse.com, paulmck@kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261023091419.167088-2-jiayuan.chen@linux.dev> X-sashiko-severity: Low 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