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

From: Dave Hansen
Date: Wed Jan 31 2024 - 15:33:28 EST


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.