Re: [PATCH v2 1/2] arch/Kconfig: Make CONFIG_CPU_SPECTRE available for all architectures

From: Mark Rutland
Date: Thu Oct 28 2021 - 09:49:42 EST


On Wed, Oct 27, 2021 at 06:33:22PM -0700, Pawan Gupta wrote:
> Borrow CONFIG_CPU_SPECTRE from ARM to be available for all
> architectures. This will help in configuration of features that depend
> on CPU being affected by spectre class of vulnerabilities.
>
> Signed-off-by: Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx>

Given that spectre isn't one specific issue, biut rather a blanket term
for a bunch of things that can have variable overlap, I don't think this
makes much sense unless we're going to add finer-grained options for all
the variants, and IMO it'd make more sene for the architectures to
directly select the things that'd otherwise be dependent on this.

Thanks,
Mark.

> ---
> arch/Kconfig | 3 +++
> arch/arm/mm/Kconfig | 3 ---
> arch/x86/Kconfig | 1 +
> 3 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 8df1c7102643..6aa856d51cb7 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -1091,6 +1091,9 @@ config ARCH_SUPPORTS_RT
> config CPU_NO_EFFICIENT_FFS
> def_bool n
>
> +config CPU_SPECTRE
> + bool
> +
> config HAVE_ARCH_VMAP_STACK
> def_bool n
> help
> diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
> index 8355c3895894..44551465fd03 100644
> --- a/arch/arm/mm/Kconfig
> +++ b/arch/arm/mm/Kconfig
> @@ -828,9 +828,6 @@ config CPU_BPREDICT_DISABLE
> help
> Say Y here to disable branch prediction. If unsure, say N.
>
> -config CPU_SPECTRE
> - bool
> -
> config HARDEN_BRANCH_PREDICTOR
> bool "Harden the branch predictor against aliasing attacks" if EXPERT
> depends on CPU_SPECTRE
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index d9830e7e1060..769739da67c6 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -124,6 +124,7 @@ config X86
> select CLKEVT_I8253
> select CLOCKSOURCE_VALIDATE_LAST_CYCLE
> select CLOCKSOURCE_WATCHDOG
> + select CPU_SPECTRE
> select DCACHE_WORD_ACCESS
> select EDAC_ATOMIC_SCRUB
> select EDAC_SUPPORT
> --
> 2.31.1
>