From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Matthew Maurer" <mmaurer@google.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
"Daniel Almeida" <daniel.almeida@collabora.com>
Subject: Re: [PATCH v3 0/4] Support more safe `AsBytes`/`FromBytes` usage
Date: Thu, 30 Apr 2026 09:27:05 +0900 [thread overview]
Message-ID: <DI62AHDXLAWA.2ZM8JKWQALKAU@nvidia.com> (raw)
In-Reply-To: <20251226-transmute-v3-0-c69a81bf8621@google.com>
Hi Matthew,
On Sat Dec 27, 2025 at 6:08 AM JST, Matthew Maurer wrote:
> Currently:
> * Slices of `AsBytes`/`FromBytes` types cannot be synthesized from
> bytes slices (without unsafe).
> * Users must use `unsafe impl` to assert that structs are `AsBytes` or
> `FromBytes` and write appropriate justifications.
> * Bindgen-generated types cannot implement `AsBytes` or `FromBytes`,
> meaning that casting them to or from bytes involves assumptions in the
> `unsafe impl` that could easily go out of sync if the underlying
> header is edited or an assumption is invalid on a platform the author
> did not consider.
>
> This series seeks to address all there of these by:
> 1. Adding slice cast functions to `FromBytes`
> 2. Adding a derive for `AsBytes` and `FromBytes`, for now restricted to
> the simple case of structs.
> 3. Refactoring the crate structure to move `AsBytes` and `FromBytes` to
> `ffi` to allow `bindings` and `uapi` to reference them.
> 4. Enabling bindgen derivation in `bindings`/`uapi` through `AsBytesFfi`
> and `FromBytesFfi`.
>
> 1+2 can be landed separately if needed, 3 has no purpose without 4, and
> 3+4 need 1+2.
>
> Signed-off-by: Matthew Maurer <mmaurer@google.com>
Do you have plans to carry this series on? If not I would be willing to
try and drive it until it can be merged, as it would be very handy to
use in nova-core.
next prev parent reply other threads:[~2026-04-30 0:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-26 21:08 [PATCH v3 0/4] Support more safe `AsBytes`/`FromBytes` usage Matthew Maurer
2025-12-26 21:08 ` [PATCH v3 1/4] rust: transmute: Support transmuting slices of AsBytes/FromBytes types Matthew Maurer
2025-12-26 21:08 ` [PATCH v3 2/4] rust: transmute: Add support for deriving `AsBytes` and `FromBytes` Matthew Maurer
2025-12-26 21:08 ` [PATCH v3 3/4] rust: transmute: Migrate AsBytes/FromBytes to ffi crate for bindgen Matthew Maurer
2025-12-26 21:08 ` [PATCH v3 4/4] rust: transmute: Support deriving AsBytes/FromBytes on bindgen types Matthew Maurer
2026-04-30 0:27 ` Alexandre Courbot [this message]
2026-04-30 3:22 ` [PATCH v3 0/4] Support more safe `AsBytes`/`FromBytes` usage Matthew Maurer
2026-04-30 8:09 ` Miguel Ojeda
2026-04-30 8:24 ` Alexandre Courbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DI62AHDXLAWA.2ZM8JKWQALKAU@nvidia.com \
--to=acourbot@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=mmaurer@google.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox