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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fb33ab90-7c9c-4840-9246-e0ad6a4db60a@lunn.ch>
Date: Wed, 19 Feb 2025 17:47:52 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Willy Tarreau <w@....eu>,
	Laurent Pinchart <laurent.pinchart@...asonboard.com>,
	James Bottomley <James.Bottomley@...senpartnership.com>,
	"Martin K. Petersen" <martin.petersen@...cle.com>,
	Dan Carpenter <dan.carpenter@...aro.org>,
	Christoph Hellwig <hch@...radead.org>,
	Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
	rust-for-linux <rust-for-linux@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Greg KH <gregkh@...uxfoundation.org>,
	David Airlie <airlied@...il.com>, linux-kernel@...r.kernel.org,
	ksummit@...ts.linux.dev
Subject: Re: Rust kernel policy

On Wed, Feb 19, 2025 at 11:33:31AM -0500, Steven Rostedt wrote:
> On Wed, 19 Feb 2025 17:15:43 +0100
> Willy Tarreau <w@....eu> wrote:
> 
> > Yeah absolutely. However I remember having faced code in the past where
> > developers had abused this "unlock on return" concept resulting in locks
> > lazily being kept way too long after an operation. I don't think this
> > will happen in the kernel thanks to reviews, but typically all the stuff
> > that's done after a locked retrieval was done normally is down outside
> > of the lock, while here for the sake of not dealing with unlocks, quite
> > a few lines were still covered by the lock for no purpose. Anyway
> > there's no perfect solution.
> 
> This was one of my concerns, and it does creep up slightly (even in my own
> use cases where I implemented them!).
> 
> But we should be encouraging the use of:
> 
> 	scoped_guard(mutex)(&my_mutex) {
> 		/* Do the work needed for for my_mutex */
> 	}
> 
> Which does work out very well. And the fact that the code guarded by the
> mutex is now also indented, it makes it easier to review.

In networking, at least for the moment, we have set a policy of only
allowing scoped_guard. The more magical, less C like constructs are
strongly discouraged. We will review this policy in a few years time,
see how well the rest of cleanup.h actually worked out in other parts
of the kernel.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ