* Re: [PATCH] x86: rust: Disable entry padding with Rust
2023-12-15 19:39 [PATCH] x86: rust: Disable entry padding with Rust Matthew Maurer
@ 2023-12-16 14:09 ` Martin Rodriguez Reboredo
2024-01-04 9:38 ` Alice Ryhl
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Martin Rodriguez Reboredo @ 2023-12-16 14:09 UTC (permalink / raw)
To: Matthew Maurer, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho
Cc: H. Peter Anvin, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, linux-kernel,
rust-for-linux
On 12/15/23 16:39, Matthew Maurer wrote:
> rustc-1.73.0 used by Linux does not support entry padding. Mark entry
> padding support as explicitly incompatible with Rust.
>
> Signed-off-by: Matthew Maurer <mmaurer@google.com>
> ---
> [...]
Hope your changes to `rustc` land.
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] x86: rust: Disable entry padding with Rust
2023-12-15 19:39 [PATCH] x86: rust: Disable entry padding with Rust Matthew Maurer
2023-12-16 14:09 ` Martin Rodriguez Reboredo
@ 2024-01-04 9:38 ` Alice Ryhl
2024-01-28 17:48 ` Miguel Ojeda
2024-01-31 20:31 ` Dave Hansen
3 siblings, 0 replies; 9+ messages in thread
From: Alice Ryhl @ 2024-01-04 9:38 UTC (permalink / raw)
To: Matthew Maurer
Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, H. Peter Anvin,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, linux-kernel, rust-for-linux
On Fri, Dec 15, 2023 at 8:48 PM Matthew Maurer <mmaurer@google.com> wrote:
>
> rustc-1.73.0 used by Linux does not support entry padding. Mark entry
> padding support as explicitly incompatible with Rust.
>
> Signed-off-by: Matthew Maurer <mmaurer@google.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] x86: rust: Disable entry padding with Rust
2023-12-15 19:39 [PATCH] x86: rust: Disable entry padding with Rust Matthew Maurer
2023-12-16 14:09 ` Martin Rodriguez Reboredo
2024-01-04 9:38 ` Alice Ryhl
@ 2024-01-28 17:48 ` Miguel Ojeda
2024-01-30 23:46 ` Dave Hansen
2024-01-31 20:31 ` Dave Hansen
3 siblings, 1 reply; 9+ messages in thread
From: Miguel Ojeda @ 2024-01-28 17:48 UTC (permalink / raw)
To: Matthew Maurer
Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, H. Peter Anvin,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, linux-kernel, rust-for-linux
On Fri, Dec 15, 2023 at 8:48 PM Matthew Maurer <mmaurer@google.com> 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@google.com>
x86: are you picking this one up through your tree? Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] x86: rust: Disable entry padding with Rust
2024-01-28 17:48 ` Miguel Ojeda
@ 2024-01-30 23:46 ` Dave Hansen
2024-01-30 23:53 ` Miguel Ojeda
2024-01-30 23:54 ` Matthew Maurer
0 siblings, 2 replies; 9+ messages in thread
From: Dave Hansen @ 2024-01-30 23:46 UTC (permalink / raw)
To: Miguel Ojeda, Matthew Maurer
Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, H. Peter Anvin,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, linux-kernel, rust-for-linux
On 1/28/24 09:48, Miguel Ojeda wrote:
> On Fri, Dec 15, 2023 at 8:48 PM Matthew Maurer <mmaurer@google.com> 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@google.com>
> 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.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] x86: rust: Disable entry padding with Rust
2024-01-30 23:46 ` Dave Hansen
@ 2024-01-30 23:53 ` Miguel Ojeda
2024-01-30 23:54 ` Matthew Maurer
1 sibling, 0 replies; 9+ messages in thread
From: Miguel Ojeda @ 2024-01-30 23:53 UTC (permalink / raw)
To: Dave Hansen
Cc: Matthew Maurer, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
H. Peter Anvin, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, linux-kernel,
rust-for-linux
On Wed, Jan 31, 2024 at 12:46 AM Dave Hansen <dave.hansen@intel.com> wrote:
>
> Do we need a 'rust-option' equivalent of 'cc-option', like:
No, at least until we start supporting several versions of the Rust
compiler (and the current version will not be in that set, so there is
no need to add complexity and spawning extra processes during the
build).
Cheers,
Miguel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] x86: rust: Disable entry padding with Rust
2024-01-30 23:46 ` Dave Hansen
2024-01-30 23:53 ` Miguel Ojeda
@ 2024-01-30 23:54 ` Matthew Maurer
1 sibling, 0 replies; 9+ messages in thread
From: Matthew Maurer @ 2024-01-30 23:54 UTC (permalink / raw)
To: Dave Hansen
Cc: Miguel Ojeda, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
H. Peter Anvin, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, linux-kernel,
rust-for-linux
On Tue, Jan 30, 2024 at 3:46 PM Dave Hansen <dave.hansen@intel.com> wrote:
>
> On 1/28/24 09:48, Miguel Ojeda wrote:
> > On Fri, Dec 15, 2023 at 8:48 PM Matthew Maurer <mmaurer@google.com> 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@google.com>
> > 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]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] x86: rust: Disable entry padding with Rust
2023-12-15 19:39 [PATCH] x86: rust: Disable entry padding with Rust Matthew Maurer
` (2 preceding siblings ...)
2024-01-28 17:48 ` Miguel Ojeda
@ 2024-01-31 20:31 ` Dave Hansen
2024-02-03 13:35 ` Miguel Ojeda
3 siblings, 1 reply; 9+ messages in thread
From: Dave Hansen @ 2024-01-31 20:31 UTC (permalink / raw)
To: Matthew Maurer, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho
Cc: H. Peter Anvin, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, linux-kernel,
rust-for-linux
On 12/15/23 11:39, Matthew Maurer wrote:
> +config HAVE_ENTRY_PADDING
> + def_bool CC_HAS_ENTRY_PADDING && !RUST
My only worry with this is that we need HAVE_ENTRY_PADDING for:
> config HAVE_CALL_THUNKS
> def_bool y
> depends on CC_HAS_ENTRY_PADDING && RETHUNK && OBJTOOL
...
> config CALL_DEPTH_TRACKING
> bool "Mitigate RSB underflow with call depth tracking"
> depends on CPU_SUP_INTEL && HAVE_CALL_THUNKS
so if they turn on RUST, they'll end up turning off CALL_DEPTH_TRACKING.
I'm wondering if it might be better to do this instead (temporarily of
course):
config RUST
bool "Rust support"
depends on HAVE_RUST
depends on RUST_IS_AVAILABLE
depends on !MODVERSIONS
depends on !GCC_PLUGINS
depends on !RANDSTRUCT
depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE
+ depends on !CALL_THUNKS
That way, someone who is using CALL_DEPTH_TRACKING doesn't accidentally
lose it by turning on RUST. To turn on RUST, they'd first need to go
turn off the things that are selecting CALL_THUNKS.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] x86: rust: Disable entry padding with Rust
2024-01-31 20:31 ` Dave Hansen
@ 2024-02-03 13:35 ` Miguel Ojeda
0 siblings, 0 replies; 9+ messages in thread
From: Miguel Ojeda @ 2024-02-03 13:35 UTC (permalink / raw)
To: Dave Hansen
Cc: Matthew Maurer, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
H. Peter Anvin, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, linux-kernel,
rust-for-linux
On Wed, Jan 31, 2024 at 9:32 PM Dave Hansen <dave.hansen@intel.com> wrote:
>
> That way, someone who is using CALL_DEPTH_TRACKING doesn't accidentally
> lose it by turning on RUST. To turn on RUST, they'd first need to go
> turn off the things that are selecting CALL_THUNKS.
+1, we should prefer to avoid disabling other things, especially since
Rust is still a bit of an "expert" option, so please feel free to add
it to the `RUST` list.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 9+ messages in thread