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: <20250704080208.0a6bd4c3@nimda.home>
Date: Fri, 4 Jul 2025 08:02:08 +0300
From: Onur <work@...rozkan.dev>
To: "Benno Lossin" <lossin@...nel.org>
Cc: <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
 <ojeda@...nel.org>, <alex.gaynor@...il.com>, <boqun.feng@...il.com>,
 <gary@...yguo.net>, <bjorn3_gh@...tonmail.com>, <a.hindborg@...nel.org>,
 <aliceryhl@...gle.com>, <tmgross@...ch.edu>, <dakr@...nel.org>,
 <acourbot@...dia.com>, <joelagnelf@...dia.com>, <wedsonaf@...il.com>
Subject: Re: [PATCH] rust: fix outdated safety note in
 `Revocable::revoke_internal`

On Thu, 03 Jul 2025 21:55:44 +0200
"Benno Lossin" <lossin@...nel.org> wrote:

> Something went wrong with your TO addresses, merging Alex's and
> Boqun's...
> 
> On Thu Jul 3, 2025 at 7:26 PM CEST, Onur Özkan wrote:
> > The code used to use `compare_exchange` in the initial version
> > but it was changed to `swap` after a reviewer suggestion (see [1]),
> > and then the safety comment was not updated and became incorrect.
> >
> > Link:
> > https://lore.kernel.org/all/20241211104742.533392-1-benoit@dugarreau.fr
> > [1]
> >
> > Signed-off-by: Onur Özkan <work@...rozkan.dev>
> > ---
> >  rust/kernel/revocable.rs | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/rust/kernel/revocable.rs b/rust/kernel/revocable.rs
> > index 06a3cdfce344..5c0b7afa76fb 100644
> > --- a/rust/kernel/revocable.rs
> > +++ b/rust/kernel/revocable.rs
> > @@ -163,8 +163,10 @@ unsafe fn revoke_internal<const SYNC:
> > bool>(&self) -> bool { unsafe { bindings::synchronize_rcu() };
> >              }
> >  
> > -            // SAFETY: We know `self.data` is valid because only
> > one CPU can succeed the
> > -            // `compare_exchange` above that takes `is_available`
> > from `true` to `false`.
> > +            // SAFETY: We just used an atomic `swap` to check if
> > the data was still marked
> > +            // as available. If it returns `true`, that means we
> > are the first (and only)
> > +            // thread to see it as available and mark it as
> > unavailable. So no other thread
> > +            // can access or drop the data after this. That makes
> > it safe to drop the data here.
> 
> I think this is already addressed by this series:
> 
>     https://lore.kernel.org/all/20250626165927.66498-1-marcelomoreira1905@gmail.com

Yeah, seems like.


Thanks,
Onur

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ