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: <DFTG8D7VQNUR.2VK3OZ0R92MEV@garyguo.net>
Date: Tue, 20 Jan 2026 13:25:58 +0000
From: "Gary Guo" <gary@...yguo.net>
To: "Boqun Feng" <boqun.feng@...il.com>, <linux-kernel@...r.kernel.org>,
 <rust-for-linux@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>,
 <kasan-dev@...glegroups.com>
Cc: "Will Deacon" <will@...nel.org>, "Peter Zijlstra"
 <peterz@...radead.org>, "Mark Rutland" <mark.rutland@....com>, "Gary Guo"
 <gary@...yguo.net>, "Miguel Ojeda" <ojeda@...nel.org>,
 Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Benno Lossin"
 <lossin@...nel.org>, "Andreas Hindborg" <a.hindborg@...nel.org>, "Alice
 Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>, "Danilo
 Krummrich" <dakr@...nel.org>, "Elle Rhumsaa" <elle@...thered-steel.dev>,
 "Paul E. McKenney" <paulmck@...nel.org>, "Marco Elver" <elver@...gle.com>,
 "FUJITA Tomonori" <fujita.tomonori@...il.com>
Subject: Re: [PATCH 2/2] rust: sync: atomic: Add atomic operation helpers
 over raw pointers

On Tue Jan 20, 2026 at 11:52 AM GMT, Boqun Feng wrote:
> In order to synchronize with C or external, atomic operations over raw

The sentence feels incomplete. Maybe "external memory"? Also "atomic operations
over raw pointers" isn't a full setence.

> pointers, althought previously there is always an `Atomic::from_ptr()`

You mean "already an"?

> to provide a `&Atomic<T>`. However it's more convenient to have helpers
> that directly perform atomic operations on raw pointers. Hence a few are
> added, which are basically a `Atomic::from_ptr().op()` wrapper.
>
> Note: for naming, since `atomic_xchg()` and `atomic_cmpxchg()` has a
> conflict naming to 32bit C atomic xchg/cmpxchg, hence they are just
> named as `xchg()` and `cmpxchg()`. For `atomic_load()` and
> `atomic_store()`, their 32bit C counterparts are `atomic_read()` and
> `atomic_set()`, so keep the `atomic_` prefix.

I still have reservation on if this is actually needed. Directly reading from C
should be rare enough that `Atomic::from_ptr().op()` isn't a big issue. To me,
`Atomic::from_ptr` has the meaning of "we know this is a field that needs atomic
access, but bindgen can't directly generate a `Atomic<T>`", and it will
encourage one to check if this is actually true, while `atomic_op` doesn't feel
the same.

That said, if it's decided that this is indeed needed, then

Reviewed-by: Gary Guo <gary@...yguo.net>

with the grammar in the commit message fixed.

Best,
Gary

>
> Signed-off-by: Boqun Feng <boqun.feng@...il.com>
> ---
>  rust/kernel/sync/atomic.rs           | 104 +++++++++++++++++++++++++++
>  rust/kernel/sync/atomic/predefine.rs |  46 ++++++++++++
>  2 files changed, 150 insertions(+)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ