From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.118 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793584574; b=SM1ZHniSnLPA3iliPyoagXqmCDGDBtY0NPyfQwTVhMjUDcZa1a7SEBMRFogK8A7wP4RW hZTRb/Yj39EOVZHtctdaGxAEH5ExA/EDPjY3h9TsUjYt/0MuiIbph4SgJejHPeOQ4zQo0 6PX2x93VmFNzSrXsB+1PLEtj/e+eBmy0EXUpgRXXMe8T3b1lyenZiCEcGmdfprRhhpvw2 Jnz4ObHGaPwbE64aA2Cn6S6+6hxuy3PHANcivVfODUAryn+eBlDptSPjOHUavk89UFQeT TmFmT1wKycgHqiCi19zIb4losjqewOpFPbETfSYcyC8HerHLszS7XY89lfffznagvbQ== 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=jqRO9tkRsjoWwY9kgOud7Ahi5SRbTBYd77uzIfnL2tPGGXeHh2xwUom3qm8myaAl2k2f Mwn9E6D8qm2PufzKC6xGXp2J1BvTey4p/lHCKm/mf2wv+viIaACehHCHEfnpLFZp5Km5J M+ipswjMLn9g28hEhqNO8YWHKnqjs/c3RJoM0HksIjr475gKRyBAzcUTlPLNzHihNb2L5 xLo7HOGWY1MT+6lVVcw7WCXq7JuHOdgb3t+SOEjdZ8koCSrdPxocjhIygdl2OgfxPq4ue Et6jf+FWv/lQEC3Lt/mnh16ndnc4aNM/d8UL6ruiesCFFCBYcBTALbS56F0kWRq4C8A== 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="i/q1ROh2"; arc=none smtp.remote-ip=95.215.58.118 Received: from mta1.migadu.com (out-118.mta1.migadu.com [95.215.58.118]) (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 AC2F3606A329 for ; Mon, 2 Nov 2026 01:56:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AC2F3606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev 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=i/q1ROh2 X-Envelope-To: linux-kernel@vger.kernel.org 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=1793584570; v=1; x=1794189370; b=i/q1ROh2Ry/IdMr35s7tZ7vEQ7ZiftKZO5/dovMQQjf3wv2HzqOCWBmiTYSqJAwOeptji1g5 /sTVb2gvpVd7KqLfc4u7dTxCV9mSUmfaQqQLxft+cjLeRSIeTeu56lou4/lgMWkoy55XxtiuI1p MiRRl6DOEWUzcDZ4Ms9gBwa0= X-Envelope-To: linux-kernel@vger.kernel.org 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 Date: Mon, 2 Nov 2026 09:55:55 +0800 From: Hangbin Liu To: Jiayuan Chen Cc: netdev@vger.kernel.org, stable@vger.kernel.org, Joel Granados , Fernando Fernandez Mancera , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan , Randy Dunlap , David Ahern , Ido Schimmel , Thomas Gleixner , Petr Pavlu , Kuniyuki Iwashima , Maoyi Xie , Zhan Xusheng , Oleg Nesterov , Neal Cardwell , Chia-Yu Chang , Yung Chih Su , Wyatt Feng , Hannes Frederic Sowa , Flavio Leitner , "Paul E. McKenney" , Petr Mladek , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net v3 5/5] net: restrict message_cost and message_burst to non-negative values Message-ID: References: <20261101061331.286404-1-jiayuan.chen@linux.dev> <20261101061331.286404-6-jiayuan.chen@linux.dev> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261101061331.286404-6-jiayuan.chen@linux.dev> 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: > > 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 > > > 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