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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72nHzEN9D2yEkXNAWGySQADtUCW_V0YtpnCvHG=nxdeDCQ@mail.gmail.com>
Date: Tue, 10 Jun 2025 20:08:29 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Daniel Almeida <daniel.almeida@...labora.com>
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>, 
	Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>, 
	Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, 
	Danilo Krummrich <dakr@...nel.org>, Alexandre Courbot <acourbot@...dia.com>, linux-kernel@...r.kernel.org, 
	rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v6] rust: kernel: add support for bits/genmask macros

On Tue, Jun 10, 2025 at 4:16 PM Daniel Almeida
<daniel.almeida@...labora.com> wrote:
>
> +use crate::build_assert;

You can include the prelude instead.

> +            (1 as $ty) .checked_shl(n)

Formatting.

> +        pub fn $unbounded_name(n: u32) -> $ty {

We may want to have a comment inside here to remind ourselves to
forward the call to the standard library one when available (1.87.0).

> +        /// Creates a compile-time contiguous bitmask for the given range by
> +        /// validating the range at runtime.

I may be confused by what you are trying to do here, but how are these
`checked` and `unbounded` ones compile-time?

Also, you can probably simplify the macro `impl` calls by removing
parameters by using `paste!`, e.g.

    let high = ::kernel::macros::paste!([<checked_bit_ $ty>])(range.end)?;

> base-commit: cf25bc61f8aecad9b0c45fe32697e35ea4b13378

This is a fairly old base now (the patch does not apply cleanly).

Thanks!

Cheers,
Miguel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ