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: <87sek3by5l.fsf@kernel.org>
Date: Fri, 13 Jun 2025 14:53:42 +0200
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "Benno Lossin" <lossin@...nel.org>
Cc: "Danilo Krummrich" <dakr@...nel.org>,  "Miguel Ojeda"
 <ojeda@...nel.org>,  "Alex Gaynor" <alex.gaynor@...il.com>,  "Boqun Feng"
 <boqun.feng@...il.com>,  "Gary Guo" <gary@...yguo.net>,  Björn Roy Baron
 <bjorn3_gh@...tonmail.com>,  "Alice Ryhl" <aliceryhl@...gle.com>,  "Trevor
 Gross" <tmgross@...ch.edu>,  "Bjorn Helgaas" <bhelgaas@...gle.com>,
  Krzysztof Wilczyński <kwilczynski@...nel.org>,  "Greg
 Kroah-Hartman"
 <gregkh@...uxfoundation.org>,  "Rafael J. Wysocki" <rafael@...nel.org>,
  "Tamir Duberstein" <tamird@...il.com>,  "Viresh Kumar"
 <viresh.kumar@...aro.org>,  <rust-for-linux@...r.kernel.org>,
  <linux-kernel@...r.kernel.org>,  <linux-pci@...r.kernel.org>
Subject: Re: [PATCH v3 2/2] rust: types: require
 `ForeignOwnable::into_foreign` return non-null

"Benno Lossin" <lossin@...nel.org> writes:

> On Thu Jun 12, 2025 at 3:09 PM CEST, Andreas Hindborg wrote:
>> The intended implementations of `ForeignOwnable` will not return null
>> pointers from `into_foreign`, as this would render the implementation of
>> `try_from_foreign` useless. Current users of `ForeignOwnable` rely on
>> `into_foreign` returning non-null pointers. So require `into_foreign` to
>> return non-null pointers.
>>
>> Suggested-by: Benno Lossin <lossin@...nel.org>
>> Suggested-by: Alice Ryhl <aliceryhl@...gle.com>
>> Signed-off-by: Andreas Hindborg <a.hindborg@...nel.org>
>> ---
>>  rust/kernel/types.rs | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs
>> index c156808a78d3..63a2559a545f 100644
>> --- a/rust/kernel/types.rs
>> +++ b/rust/kernel/types.rs
>> @@ -43,6 +43,7 @@ pub unsafe trait ForeignOwnable: Sized {
>>      /// # Guarantees
>>      ///
>>      /// - Minimum alignment of returned pointer is [`Self::FOREIGN_ALIGN`].
>> +    /// - The returned pointer is not null.
>
> This also needs to be mentioned in the `Safety` section of this trait.
> Alternatively you can put "Implementers must ensure the guarantees on
> [`into_foreign`] are upheld." or similar.

Which is exactly what I did :)


Best regards,
Andreas Hindborg




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ