[PATCH v2] hardening: Default randstruct off with rust for better allmodconfig support
Miguel Ojeda
miguel.ojeda.sandonis at gmail.com
Fri Jun 5 17:22:54 UTC 2026
On Fri, Jun 5, 2026 at 6:51 PM Mark Brown <broonie at kernel.org> wrote:
>
> Currently randstruct does not support rust so we have Kconfig dependencies
> which prevent rust being enabled when randstruct is. Unfortunately this
> prevents rust being enabled in allmodconfig, our standard coverage build.
> randstruct gets turned on by default, then the dependency on !RANDSTRUCT
> causes rust to get disabled.
>
> Work around this by disabling randstruct by default if we have a usable
> rust toolchain and rust support for the architecture, circular
> dependencies prevent us directly depending on !RUST. This means we might
> end up with a configuration that disables both rust and randstruct but
> hopefully it's more likely go give the expected result.
>
> Signed-off-by: Mark Brown <broonie at kernel.org>
Thanks Mark!
Kees, Gustavo: applying this would help Mark's testing of Rust in
linux-next, which is important to keep.
An alternative would be to move forward with `RANDSTRUCT` support:
https://lore.kernel.org/rust-for-linux/20260323130224.165738-1-ojeda@kernel.org/
Either the conditional (on the Rust side) or the unconditional
approaches (modifying the C side) should be fine, i.e. whatever
Kees/Gustavo think is best. The unconditional one would make things
easier on the Rust side, but it is a "bigger" change in terms of
impact. We can always start with the conditional one instead.
Cheers,
Miguel
More information about the Linux-security-module-archive
mailing list