[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <997d9bf9-2a8b-452f-b458-2fa15f92918e@citrix.com>
Date: Thu, 11 Apr 2024 11:02:42 +0100
From: Andrew Cooper <andrew.cooper3@...rix.com>
To: Josh Poimboeuf <jpoimboe@...nel.org>, x86@...nel.org
Cc: linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Daniel Sneddon <daniel.sneddon@...ux.intel.com>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Alexandre Chartre <alexandre.chartre@...cle.com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Peter Zijlstra <peterz@...radead.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sean Christopherson <seanjc@...gle.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Nikolay Borisov <nik.borisov@...e.com>, KP Singh <kpsingh@...nel.org>,
Waiman Long <longman@...hat.com>, Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH 3/7] x86/bugs: Fix BHI handling of RRSBA
On 11/04/2024 6:40 am, Josh Poimboeuf wrote:
> The ARCH_CAP_RRSBA check isn't correct: RRSBA may have already been
> disabled by the Spectre v2 mitigation (or can otherwise be disabled by
> the BHI mitigation itself if needed). In that case retpolines are fine.
>
> Fixes: ec9404e40e8f ("x86/bhi: Add BHI mitigation knob")
> Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
> ---
> arch/x86/kernel/cpu/bugs.c | 30 ++++++++++++++++++------------
> 1 file changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 27d6d64eeec3..0755600d5d18 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -1538,20 +1538,25 @@ static enum spectre_v2_mitigation __init spectre_v2_select_retpoline(void)
> return SPECTRE_V2_RETPOLINE;
> }
>
> +static bool __ro_after_init rrsba_disabled;
> +
> /* Disable in-kernel use of non-RSB RET predictors */
> static void __init spec_ctrl_disable_kernel_rrsba(void)
> {
> - u64 ia32_cap;
> + if (rrsba_disabled)
> + return;
> +
> + if (!(ia32_cap & ARCH_CAP_RRSBA)) {
> + rrsba_disabled = true;
> + return;
> + }
You'll take this path if you have out-of-date microcode.
RRSBA is only enumerated from September last year, IIRC. (Definitely
from this point on some CPUs.)
When RRSBA was introduced, I was under the (false) impression that all
eIBRS systems suffered RRSBA, but it turns out that select parts
(ICX,TGL,RKL) are non-RRSBA despite not having RRSBA_CTRL.
~Andrew
Powered by blists - more mailing lists