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] [day] [month] [year] [list]
Message-ID: <Z6mRMzzr045Rk7gl@Mac.home>
Date: Sun, 9 Feb 2025 21:40:03 -0800
From: Boqun Feng <boqun.feng@...il.com>
To: Benno Lossin <benno.lossin@...ton.me>
Cc: Mitchell Levy <levymitchell0@...il.com>,
	Miguel Ojeda <ojeda@...nel.org>,
	Alex Gaynor <alex.gaynor@...il.com>, Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>,
	Andreas Hindborg <a.hindborg@...nel.org>,
	Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
	Danilo Krummrich <dakr@...nel.org>,
	Wedson Almeida Filho <walmeida@...rosoft.com>,
	Martin Rodriguez Reboredo <yakoyoku@...il.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
	Waiman Long <longman@...hat.com>, rust-for-linux@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/2] rust: lockdep: Use Pin for all LockClassKey usages

On Sun, Feb 09, 2025 at 09:57:00AM +0000, Benno Lossin wrote:
> On 08.02.25 01:39, Mitchell Levy wrote:
> > Reintroduce dynamically-allocated LockClassKeys such that they are
> > automatically (de)registered. Require that all usages of LockClassKeys
> > ensure that they are Pin'd.
> > 
> > Currently, only `'static` LockClassKeys are supported, so Pin is
> > redundant. However, it is intended that dynamically-allocated
> > LockClassKeys will eventually be supported, so using Pin from the outset
> > will make that change simpler.
> > 
> > Closes: https://github.com/Rust-for-Linux/linux/issues/1102
> > Suggested-by: Benno Lossin <benno.lossin@...ton.me>
> > Suggested-by: Boqun Feng <boqun.feng@...il.com>
> > Signed-off-by: Mitchell Levy <levymitchell0@...il.com>
> 
> One nit below, but it's fine.
> 
> Reviewed-by: Benno Lossin <benno.lossin@...ton.me>
> 

Thank you both!

> > ---
> >  rust/helpers/helpers.c          |  1 +
> >  rust/helpers/sync.c             | 13 ++++++++++
> >  rust/kernel/sync.rs             | 57 ++++++++++++++++++++++++++++++++++++++---
> >  rust/kernel/sync/condvar.rs     |  5 ++--
> >  rust/kernel/sync/lock.rs        |  9 +++----
> >  rust/kernel/sync/lock/global.rs |  5 ++--
> >  rust/kernel/sync/poll.rs        |  2 +-
> >  rust/kernel/workqueue.rs        |  2 +-
> >  8 files changed, 78 insertions(+), 16 deletions(-)
> 
> [...]
> 
> > diff --git a/rust/kernel/sync/lock.rs b/rust/kernel/sync/lock.rs
> > index eb80048e0110..6dafe338bbc7 100644
> > --- a/rust/kernel/sync/lock.rs
> > +++ b/rust/kernel/sync/lock.rs
> > @@ -7,12 +7,9 @@
> > 
> >  use super::LockClassKey;
> >  use crate::{
> > -    init::PinInit,
> > -    pin_init,
> > -    str::CStr,
> > -    types::{NotThreadSafe, Opaque, ScopeGuard},
> > +    init::PinInit, pin_init, str::CStr, types::NotThreadSafe, types::Opaque, types::ScopeGuard,
> 
> Why does this change exist? I prefer imports to be merged.
> 

Agreed. Queued with this change reverted.

Regards,
Boqun

> ---
> Cheers,
> Benno
> 
> >  };
> > -use core::{cell::UnsafeCell, marker::PhantomPinned};
> > +use core::{cell::UnsafeCell, marker::PhantomPinned, pin::Pin};
> >  use macros::pin_data;
> > 
> >  pub mod mutex;
> > @@ -129,7 +126,7 @@ unsafe impl<T: ?Sized + Send, B: Backend> Sync for Lock<T, B> {}
> > 
> >  impl<T, B: Backend> Lock<T, B> {
> >      /// Constructs a new lock initialiser.
> > -    pub fn new(t: T, name: &'static CStr, key: &'static LockClassKey) -> impl PinInit<Self> {
> > +    pub fn new(t: T, name: &'static CStr, key: Pin<&'static LockClassKey>) -> impl PinInit<Self> {
> >          pin_init!(Self {
> >              data: UnsafeCell::new(t),
> >              _pin: PhantomPinned,
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ