[PATCH] rust: security: replace `core::mem::zeroed` with `pin_init::zeroed`
Paul Moore
paul at paul-moore.com
Thu Sep 10 19:00:15 UTC 2026
On Aug 27, 2026 Nils Lehnen <nils.lehnen at proton.me> wrote:
>
> All types in `bindings` implement `Zeroable` if they can, so use
> `pin_init::zeroed` instead of relying on `unsafe` code.
>
> If this ends up not compiling in the future, something in bindgen or on
> the C side changed and is most likely incorrect.
>
> Link: https://lore.kernel.org/r/20250814093046.2071971-8-lossin@kernel.org
> Link: https://github.com/Rust-for-Linux/linux/issues/1189
> Signed-off-by: Benno Lossin <lossin at kernel.org>
> Reviewed-by: Alexandre Courbot <acourbot at nvidia.com>
> Signed-off-by: Nils Lehnen <nils.lehnen at proton.me>
> Link: https://patch.msgid.link/...
> Reviewed-by: Alice Ryhl <aliceryhl at google.com>
> Reviewed-by: Miguel Ojeda <ojeda at kernel.org>
> Reviewed-by: Gary Guo <gary at garyguo.net>
> ---
> Resend of Benno's patch from the Zeroable series [1]: only patches 1, 2
> and 11 of that series were applied, and the issue [2] asks for the rest
> to be re-sent. Rebased onto rust-next; it applied cleanly, and a
> defconfig build with CONFIG_RUST=y and CONFIG_SECURITY=y passes.
>
> Two equivalent one-off patches were posted earlier [3][4]; Miguel asked
> in [5] for a resend that keeps Benno's authorship, which this is.
> Cc'ing the LSM list per Paul's request on the original thread.
>
> [1] https://lore.kernel.org/r/20250814093046.2071971-1-lossin@kernel.org
> [2] https://github.com/Rust-for-Linux/linux/issues/1189
> [3] https://lore.kernel.org/r/20251129135657.36144-1-atharvd440@gmail.com
> [4] https://lore.kernel.org/r/20260120083824.477339-8-sunke@kylinos.cn
> [5] https://lore.kernel.org/r/CANiq72nJqFOR9vhPBfZUNrxU+M1HMV6wN9bN6i8e9rf_oOD2qw@mail.gmail.com
>
> rust/kernel/security.rs | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Merged into lsm/dev, thanks everyone!
--
paul-moore.com
More information about the Linux-security-module-archive
mailing list