Re: [PATCH] x86: rust: Disable entry padding with Rust

From: Matthew Maurer
Date: Tue Jan 30 2024 - 18:54:52 EST


On Tue, Jan 30, 2024 at 3:46 PM Dave Hansen <dave.hansen@xxxxxxxxx> wrote:
>
> On 1/28/24 09:48, Miguel Ojeda wrote:
> > On Fri, Dec 15, 2023 at 8:48 PM Matthew Maurer <mmaurer@xxxxxxxxxx> wrote:
> >> rustc-1.73.0 used by Linux does not support entry padding. Mark entry
> >> padding support as explicitly incompatible with Rust.
> > We are now at 1.74.1 and moving to 1.75.0 for the next cycle, which
> > does not support it yet, in case whoever applies the patch wants to
> > update it in the description.
> >
> >> Signed-off-by: Matthew Maurer <mmaurer@xxxxxxxxxx>
> > x86: are you picking this one up through your tree? Thanks!
>
> Do we need a 'rust-option' equivalent of 'cc-option', like:
>
> config CC_HAS_ENTRY_PADDING
> def_bool $(cc-option,-fpatchable-function-entry=16,16)
>
> That way this doesn't become a temporary option at all. We just do:
>
> config RUST_HAS_ENTRY_PADDING
> def_bool $(rust-option,-fpatchable-function-entry) # or whatever
>
> and:
>
> config HAVE_ENTRY_PADDING
> def_bool CC_HAS_ENTRY_PADDING
> depends on !RUST || RUST_HAS_ENTRY_PADDING
>
> and never have to touch this again.
I agree that we'll want something like that in the long term (my
original version of this patch did use something like `rs-option`),
but in this particular case the main thing still being bikeshedded in
the RFC[1] *is* how the option will be specified to the Rust compiler.

We could assume the current form of the RFC which is nearly signed off
on is what will happen, in which case we could add `rs-option` and
test for `-C patchable-function-entry=total_nops=16,prefix_nops=16`,
but there's a chance we could still have to update it until the flag
form is finalized.

Link: https://github.com/rust-lang/rfcs/pull/3543 [1]