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: <87iko5gtcm.fsf@kernel.org>
Date: Wed, 19 Mar 2025 12:20:09 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "Danilo Krummrich" <dakr@...nel.org>
Cc: <bhelgaas@...gle.com>,  <gregkh@...uxfoundation.org>,
  <rafael@...nel.org>,  <ojeda@...nel.org>,  <alex.gaynor@...il.com>,
  <boqun.feng@...il.com>,  <gary@...yguo.net>,  <bjorn3_gh@...tonmail.com>,
  <benno.lossin@...ton.me>,  <aliceryhl@...gle.com>,  <tmgross@...ch.edu>,
  <linux-pci@...r.kernel.org>,  <rust-for-linux@...r.kernel.org>,
  <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] rust: platform: impl Send + Sync for platform::Device

"Danilo Krummrich" <dakr@...nel.org> writes:

> Commit 4d320e30ee04 ("rust: platform: fix unrestricted &mut
> platform::Device") changed the definition of platform::Device and
> discarded the implicitly derived Send and Sync traits.
>
> This isn't required by upstream code yet, and hence did not cause any
> issues. However, it is relied on by upcoming drivers, hence add it back
> in.
>
> Signed-off-by: Danilo Krummrich <dakr@...nel.org>
> ---
>  rust/kernel/platform.rs | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/rust/kernel/platform.rs b/rust/kernel/platform.rs
> index c77c9f2e9aea..2811ca53d8b6 100644
> --- a/rust/kernel/platform.rs
> +++ b/rust/kernel/platform.rs
> @@ -233,3 +233,10 @@ fn as_ref(&self) -> &device::Device {
>          unsafe { device::Device::as_ref(dev) }
>      }
>  }
> +
> +// SAFETY: A `Device` is always reference-counted and can be released from any thread.
> +unsafe impl Send for Device {}
> +
> +// SAFETY: `Device` can be shared among threads because all methods of `Device`
> +// (i.e. `Device<Normal>) are thread safe.
> +unsafe impl Sync for Device {}

Same as for 1/2:

  # git am --show-current-patch=diff | patch -p1
  patching file rust/kernel/platform.rs
  Hunk #1 succeeded at 198 with fuzz 1 (offset -35 lines).


Reviewed-by: Andreas Hindborg <a.hindborg@...nel.org>


Best regards,
Andreas Hindborg



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ