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: <D889TYXZRPX1.5WNAFLTJSKKW@proton.me>
Date: Wed, 05 Mar 2025 10:47:19 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Andreas Hindborg <a.hindborg@...nel.org>
Cc: 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>, Danilo Krummrich <dakr@...nel.org>, rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 07/22] rust: pin-init: move the default error behavior of `try_[pin_]init`

On Wed Mar 5, 2025 at 11:29 AM CET, Andreas Hindborg wrote:
> "Benno Lossin" <benno.lossin@...ton.me> writes:
>
>> Move the ability to just write `try_pin_init!(Foo { a <- a_init })`
>> (note the missing `? Error` at the end) into the kernel crate.
>> Remove this notation from the pin-init crate, since the default when no
>> error is specified is the kernel-internal `Error` type. Instead add two
>> macros in the kernel crate that serve this default and are used instead
>> of the ones from `pin-init`.
>>
>> This is done, because the `Error` type that is used as the default is
>> from the kernel crate and it thus prevents making the pin-init crate
>> standalone.
>>
>> In order to not cause a build error due to a name overlap, the macros in
>> the pin-init crate are renamed, but this change is reverted in a future
>> commit when it is a standalone crate.
>>
>> Signed-off-by: Benno Lossin <benno.lossin@...ton.me>
>
> [...]
>
>> diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs
>> index dde2e0649790..4123d478c351 100644
>> --- a/rust/kernel/prelude.rs
>> +++ b/rust/kernel/prelude.rs
>> @@ -28,7 +28,8 @@
>>  pub use super::{dev_alert, dev_crit, dev_dbg, dev_emerg, dev_err, dev_info, dev_notice, dev_warn};
>>  pub use super::{pr_alert, pr_crit, pr_debug, pr_emerg, pr_err, pr_info, pr_notice, pr_warn};
>>
>> -pub use super::{init, pin_init, try_init, try_pin_init};
>> +pub use super::{init, pin_init};
>> +pub use super::{try_init, try_pin_init};
>
> Are you trying out a new scheme here - a balance between normalized and
> line-by-line use declarations? 😆

Uh no, not intentionally at least. This is an artifact of moving the
changes between the different patches, the "rust: make pin-init its own
crate" commit removes the line with `init` and `pin_init`, but keeps the
one with the `try_` versions. That is because those two will continue to
live in the `kernel` crate.

---
Cheers,
Benno


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ