Article View: linux.kernel.netdev
Article #9434Re: [PATCH net v3 5/5] net: restrict message_cost and message_burst to non-negative values
From: Hangbin Liu
Date: Mon, 02 Nov 2026 01:55
Date: Mon, 02 Nov 2026 01:55
50 lines
11031 bytes
11031 bytes
Hi Jiayuan,
On Sun, Nov 01, 2026 at 02:12:03PM +0800, Jiayuan Chen wrote:
> net.core.message_cost and net.core.message_burst feed the interval and
> burst of net_ratelimit_state, but neither rejects negative values:
> message_burst uses plain proc_dointvec, and message_cost uses
> proc_dointvec_jiffies, which happily stores -1 second as -HZ jiffies.
>
> Since commit a940d145cc38 ("ratelimit: Warn if ->interval or ->burst are
> negative"), ___ratelimit() splats on such values, so the next
> net_ratelimit() caller warns, e.g. a martian source log:
>
> Negative interval (-250) or burst (10): Uninitialized ratelimit_state structure?
> WARNING: lib/ratelimit.c:43 at ___ratelimit+0x56e/0x960, CPU#1: ping/3218
> RIP: 0010:___ratelimit+0x578/0x960
> Call Trace:
> <IRQ>
> net_ratelimit+0x1c/0x30
> ip_handle_martian_source+0x1bb/0x340
> ip_route_input_slow+0x1057/0x3650
> ip_route_input_noref+0x104/0x260
> arp_process+0x109b/0x2510
> arp_rcv+0x381/0x460
> __netif_receive_skb_one_core+0x173/0x1c0
> __netif_receive_skb+0x21/0x150
> process_backlog+0x37e/0x1200
> __napi_poll.constprop.0+0xa5/0x5e0
> net_rx_action+0x4c0/0xf70
> handle_softirqs+0x204/0x9b0
> __do_softirq+0x10/0x18
> do_softirq.part.0+0x49/0xd0
> </IRQ>
>
> Negative values never meant anything here: 0 already expresses both
> "no limit" (interval) and "suppress everything" (burst).
Will this limit breaks the UAPI on old kernels that supports negative values?
As the comment in ___ratelimit() says:
/*
* Zero interval says never limit, otherwise, non-positive burst
* says always limit.
*/
If all others agree to set the limit in this patch. I think the comment
and the WARN_ONCE() , and the admin-guide/sysctl/net.rst all need to be updated.
Thanks
Hangbin
Technical Details
Message-ID:
<auftqzpuuNFiScrb@fedora>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354425-linux-kernel-netdev=dewy.ruReferences:
<20261101061331.286404-1-jiayuan.chen@linux.dev> <20261101061331.286404-6-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-354425-linux-kernel-netdev=dewy.ru From: hangbin.liu@linux.dev (Hangbin Liu) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v3 5/5] net: restrict message_cost and message_burst to non-negative values Date: Mon, 2 Nov 2026 09:55:55 +0800 Organization: Usenet Network Message-ID: <auftqzpuuNFiScrb@fedora> References: <20261101061331.286404-1-jiayuan.chen@linux.dev> <20261101061331.286404-6-jiayuan.chen@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="2823748"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:L0bEd9lpSvBMGjrDEsPAzTGFb88= sha256:3Z5Smm8KApoqlFOVe6fcLlHvAcrs6K500f0d9Z8ierE= sha1:oB2IfqMIm55IR6nGsJ2tvJsrVHc= sha256:Vq3Ik8TEmlcd1OTlOve1mxA9Y5b1CLkHqVxTvskBiKY= Content-Disposition: inline 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 0BDC31123F9; Mon, 2 Nov 2026 04:56:43 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.049 X-Spam-Status: No, score=-3.049 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, 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 TOjxDWQ6DNDL; Mon, 2 Nov 2026 04:56:40 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-354425-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 06E6E1123F5; Mon, 2 Nov 2026 04:56:32 +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 53BB32A585; Mon, 2 Nov 2026 01:56:15 +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=1793584575; b=HsZ2bPlDelHQkcBoOv2pY8uqucEg0edMbDVMf6cjXDB8oBUId+YI0j0HCWa+cqU2b2vy NGsMm3/HTr/sUbSgfwzh4h7xVKIuhgJsAMjvnDWzun5uv9KVQrYg0hhq3nnJknCWsrKx+ gF7Af7NO30nHOhxtp9i0SnvGxcDQkSiedj5TvlXZpTzTwyraDj4gROcH0CXa+zACe99y2 4aQEHizBViFGiFwvkxgkKo824Cm2JxjvtUfW7i6QX+B/aALRNRZkrYD6OAEVBhm2BdPjZ EVk79smEzBZ8rPuIT+4RzzgbEcX06Gw6nN20OVD6+ra9ZAQKMJL2FOKhTdRcDKwpGFQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793584575; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=hPEzD1WQWoI6DLgJc3nFH78eRCH06B+HG0fOl1fLX4c=; b=NYjA30eDpzyNkjvbY/WZPbCA1pxx/CktaCqD93M7uuR9bJ3uR2FVZx851/CnMQoBphaX ffOxvl1oB9MDA04+eQaexEIR+S1r2BUOwJHoIfeM/NGl97Xr4dkJBT129+6GoYThTAqwX Qs5EKxkiekkrrj0xq/m8xQZFZZUq14axjBUHiqYiesojTc5cxS8/Ji2A9cuYDu3LgW6Im 0U6wlv8cTvN9n92YmxLQ536H/nK0AUsHu7H6WggG4fffXqKAst2XXWfrrovS4+WzwKMUZ p7EougLpgLdR/Lp2AaCOofGMpuuXFq6lHzYtCFOdaLF6nFWKfpiltqn9/r5qh191J0w== 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=YHrAtH40; 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 F1E63606A337; Mon, 2 Nov 2026 01:56:14 +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=YHrAtH40 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.79 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793584574; b=m0WeP9SnWgnoEcdx8L/YZd3KvTNfadF8eq7ebdEA46F1B1J5kHSikPQ8s3H7cb5Zr8lX 7zNxNH6xNxvMvkF8adXs92VbTQakJp6m2fDmofqpbNUvF9xZWiDi/7s+1Zv5beNh6QBad v3luGgpobTPuBN6l+9HZuyinHNzFN+lfoCLYts6um3hgnWkD+QPBFpB35GxMvG9ikTUMl ce78kcqDA7p9XlcgPIflti/Cd1FpZlqRWXfehLZ+YJdPLG2lT5botg5gfiHcHSvuEQxCN TbeFHwooKZvF+ZZVHob1dG8DEpxr5pt1pNza273OujQiXhRgZOR4ugr8MWwNbITWP6w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793584574; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=hPEzD1WQWoI6DLgJc3nFH78eRCH06B+HG0fOl1fLX4c=; b=uQ/BbFqDJYbh+RX9DeiqUW71F/3DPD0OpgC+hWk8SKUSdG5wjlSiCyit8JdDl60WptoU Tt41LNMwurgqUbh916+oL7CZdpLNBDo7zzveCFdnYjMGkLU84g/W1PwVbmBanGauxTTzX 1ijB+Ouq0ojytVUawsr1oa/qyWkaspSffa0exP4kw/GSA4oWyMplo2ByvoKgdBFVVytb6 5FxWlC5FHqSB0vFj+l+fR5gMwRpj9v7Nxn1ZsMhvGEOHXO33Ux9R6krZlvmtK9NshHgtr HwaJhdSsv9Ifdwfqu7+bf0nIf1het/QnxeM1oCdPaHbxVMe+CC1pSfU7Fd8J8iiaWww== 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=YHrAtH40; arc=none smtp.remote-ip=91.218.175.79 X-Received: from mta0.migadu.com (out-79.mta0.migadu.com [91.218.175.79]) (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 060C8606A326 for <netdev@vger.kernel.org>; Mon, 2 Nov 2026 01:56:12 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 060C8606A326 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=n3WZoTD06QO8DsgnhDFWT7ENJHabABG8avIZs4EqSgM=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1793584569; v=1; x=1794189369; b=YHrAtH40i6qMws9zWmeetS+iRqr+RPArTaiOrwJidof3NYivR0S/EkbzbE864zaISdsU4LT0 S8AkGy1tas20osHyaFCcaAedFOHvK6TSLElA1W1FPMVc0ap0kPSBistoVJKiCLwhtTGfcQJCTaE 8WeqqzRq9yxwLR/hRLVLe2Ks= X-Envelope-To: netdev@vger.kernel.org X-Received: by mta10.migadu.com with ESMTPS id d5ce155f172fdd98; Mon, 02 Nov 2026 01:56:09 +0000 X-Mizu-Trace-ID: d5ce155f172fdd98 X-Migadu-Flow: FLOW_OUT X-Cc: netdev@vger.kernel.org, stable@vger.kernel.org, Joel Granados <joel.granados@kernel.org>, Fernando Fernandez Mancera <fmancera@suse.de>, "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>, Thomas Gleixner <tglx@kernel.org>, Petr Pavlu <petr.pavlu@suse.com>, Kuniyuki Iwashima <kuniyu@google.com>, Maoyi Xie <maoyi.xie@ntu.edu.sg>, Zhan Xusheng <zhanxusheng1024@gmail.com>, Oleg Nesterov <oleg@redhat.com>, Neal Cardwell <ncardwell@google.com>, Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>, Yung Chih Su <yuuchihsu@gmail.com>, Wyatt Feng <bronzed_45_vested@icloud.com>, Hannes Frederic Sowa <hannes@stressinduktion.org>, Flavio Leitner <fbl@redhat.com>, "Paul E. McKenney" <paulmck@kernel.org>, Petr Mladek <pmladek@suse.com>, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org 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 X-In-Reply-To: <20261101061331.286404-6-jiayuan.chen@linux.dev>