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: <46e19de8-d901-4f57-a898-3717c554e067@de.bosch.com>
Date: Wed, 21 Jan 2026 10:16:25 +0100
From: Dirk Behme <dirk.behme@...bosch.com>
To: Alexandre Courbot <acourbot@...dia.com>, Danilo Krummrich
	<dakr@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, Daniel Almeida
	<daniel.almeida@...labora.com>, Miguel Ojeda <ojeda@...nel.org>, Boqun Feng
	<boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>, Benno Lossin
	<lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>, Trevor Gross
	<tmgross@...ch.edu>
CC: Yury Norov <yury.norov@...il.com>, John Hubbard <jhubbard@...dia.com>,
	Alistair Popple <apopple@...dia.com>, Joel Fernandes <joelagnelf@...dia.com>,
	Timur Tabi <ttabi@...dia.com>, Edwin Peer <epeer@...dia.com>, Eliot Courtney
	<ecourtney@...dia.com>, Steven Price <steven.price@....com>,
	<rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 0/5] rust: add `register!` macro

On 21/01/2026 08:23, Alexandre Courbot wrote:
> Add an improved version of nova-core's `register!` macro to the `kernel`
> crate for all drivers to use.
> 
> This is not a direct move from `nova-core`, but rather a new
> introduction to facilitate code review and introduce features that are
> missing in the nova-core versions. Differences notably include:
> 
> - Use of `Bounded` to prevent any data truncation when manipulating
>    bitfields,
> - Extended documentation,
> - Doccomments now build and run,
> - Supports visibility and different storage sizes.
> 
> The `bitfield!` macro of nova-core has for the moment been wrapped into
> `register!`, as a set of private rules, to allow `register!` to be
> merged first while `bitfield!` undergoes review during the next cycle.
> Thus, some of the code from v1 (including `bitfield!`'s doccomments and
> Kunit tests) are kept for later.
> 
> The first patch enables the `generic_arg_infer` feature, which is
> required for generic type inference and used in subsequent patches. This
> feature is stable since rustc 1.89.
> 
> The second patch adds `shr` and `shl` methods to `Bounded`. These were
> suggested by Alice during LPC as a way to avoid the use of the
> controversial `Bounded::from_expr` in both the bitfield macro and the
> Nova code. Third patch adds another convenience method to obtain a
> `bool` from single-bit `Bounded`s.
> 
> Patch 4 adds the `register!` macro. Since it falls under
> `rust/kernel/io` it is covered by the corresponding MAINTAINERS entry so
> I refrained from adding one just for this file, especially since the
> bitfield-related parts will eventually move and what remains is very
> tightly related to I/O.
> 
> The last patch illustrates how this macro is used by converting
> nova-core to use it, and removing the local implementation. This patch
> is to be merged one cycle after the other patches.
> 
> Previous work to extract the macros was done in the partially-merged
> [1]. The current series can be considered a reboot with more features
> and the `bitfield!` macro being postponed.
> 
> This patchset is based on `driver-core-next`.
> 
> Note that it also need `rust-fixes` to avoid an `unused_unsafe` warning.
> 
> [1] https://lore.kernel.org/all/20251003154748.1687160-1-joelagnelf@nvidia.com/
> 
> Signed-off-by: Alexandre Courbot <acourbot@...dia.com>

I gave this v2 a try on top of my 6.19.0-rc3 and it compiles now using 
rustc 1.81.0. I adapted my aarch64 timer TMU test using register!() and 
it works as expected. With this:

Tested-by: Dirk Behme <dirk.behme@...bosch.com>

Many thanks!

Dirk

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ