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: <aN1DlPjbQgzfmpUl@ada.csh.rit.edu>
Date: Wed, 1 Oct 2025 11:07:00 -0400
From: Mary Strodl <mstrodl@....rit.edu>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: linux-kernel@...r.kernel.org, brgl@...ev.pl, linux-gpio@...r.kernel.org,
	"Paul E. McKenney" <paulmck@...nel.org>,
	Tzung-Bi Shih <tzungbi@...nel.org>
Subject: Re: [PATCH v2 1/3] gpio: mpsse: use rcu to ensure worker is torn down

Hey Linus,

On Wed, Oct 01, 2025 at 09:15:14AM +0200, Linus Walleij wrote:
> Oh this RCU thing is a bit terse and a lot of code.
> 
> Can you look if you can use the new revocable resource
> management API? It uses RCU underneath.
> https://lwn.net/Articles/1038523/

Yeah I'm very open to suggestions about how to do this nicer.

I can't read that article, because I don't subscribe to LWN (Maybe I should
though). Looks like it becomes free tomorrow, so I can take a look then. I did
find and skim through this, which I believe is the implementation of the API
you're talking about:
https://lore.kernel.org/chrome-platform/20250923075302.591026-2-tzungbi@kernel.org/

Based on this, it seems like:
* This uses sleepable RCU, which I don't think we can use in the IRQ callbacks
  since they don't allow any blocking (this is the main reason for the complexity)
* We'd still need some sort of list primitive, because we could potentially have
  multiple workers being torn down at a time, so we need to know what all to
  revoke when the device is being torn down. Right now, I'm using the RCU lists
  API to keep track of this. My instinct is to use devm, but that also isn't
  technically safe for use in IRQ handlers.

I obviously haven't played with the revocable resource management API, so
maybe these limitations aren't as big of a deal as I think they are.

With that said, I think now that I've found spinlocks work, I could use those
to gate access to the list everywhere, and use the standard lists api rather
than the RCU lists api. Obviously teardown of the workers would happen outside
the spin lock critical section, guarded by a proper mutex.

Let me know what you think... Thank you!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ