lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <06ba971191eeb80cea711653b737b16221899cf9.camel@perches.com>
Date: Fri, 14 Feb 2025 06:00:17 -0800
From: Joe Perches <joe@...ches.com>
To: Mateusz Polchlopek <mateusz.polchlopek@...el.com>, Kuniyuki Iwashima
	 <kuniyu@...zon.com>, "David S. Miller" <davem@...emloft.net>, Eric Dumazet
	 <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
	 <pabeni@...hat.com>, Simon Horman <horms@...nel.org>
Cc: Andy Whitcroft <apw@...onical.com>, Dwaipayan Ray
 <dwaipayanray1@...il.com>,  Lukas Bulwahn <lukas.bulwahn@...il.com>,
 Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v2 net-next] checkpatch: Discourage a new use of
 rtnl_lock() variants.

On Fri, 2025-02-14 at 10:24 +0100, Mateusz Polchlopek wrote:
> 
> On 2/14/2025 5:54 AM, Kuniyuki Iwashima wrote:
> > rtnl_lock() is a "Big Kernel Lock" in the networking slow path
> > and still serialises most of RTM_(NEW|DEL|SET)* rtnetlink requests.
> > 
> > Commit 76aed95319da ("rtnetlink: Add per-netns RTNL.") started a
> > very large, in-progress, effort to make the RTNL lock scope per
> > network namespace.
> > 
> > However, there are still some patches that newly use rtnl_lock(),
> > which is now discouraged, and we need to revisit it later.
> > 
> > Let's warn about the case by checkpatch.
> > 
> > The target functions are as follows:
> > 
> >    * rtnl_lock()
> >    * rtnl_trylock()
> >    * rtnl_lock_interruptible()
> >    * rtnl_lock_killable()
> > 
> > and the warning will be like:
> > 
> >    WARNING: A new use of rtnl_lock() variants is discouraged, try to use rtnl_net_lock(net) variants
> >    #18: FILE: net/core/rtnetlink.c:79:
> >    +	rtnl_lock();
> > 
> > Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> > Reviewed-by: Simon Horman <horms@...nel.org>
> > ---
> > v2:
> >    * Remove unnecessary "^\+.*"
> >    * Match "rtnl_lock	 ()"
> > 
> > v1: https://lore.kernel.org/netdev/20250211070447.25001-1-kuniyu@amazon.com/
> > ---
> >   scripts/checkpatch.pl | 6 ++++++
> >   1 file changed, 6 insertions(+)
> > 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> > @@ -6995,6 +6995,12 @@ sub process {
> >   #			}
> >   #		}
> >   
> > +# A new use of rtnl_lock() is discouraged as it's being converted to rtnl_net_lock(net).
> > +		if ($line =~ /\brtnl_(try)?lock(_interruptible|_killable)?\s*\(\)/) {
> > +			WARN("rtnl_lock()",
> > +			     "A new use of rtnl_lock() variants is discouraged, try to use rtnl_net_lock(net) variants\n" . $herecurr);

UPPER_CASE ALPHANUMERIC only for the key value please
and there could be whitespace between the parentheses

Perhaps:
		if ($line =~ /\brtnl_((?:try)?lock(?:_interruptible|_killable)?)\s*\(\s*\)/) {
			WARN("RTNL_LOCK",
			     "New use of rtnl_$1, prefer rtnl_net_$1(net)\n" . $herecurr);
		}

though there doesn't seem to be any uses of interruptible variants
in the tree I looked at.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ