Re: [PATCH 02/22] x86/srso: Set CPUID feature bits independently of bug or mitigation status

From: Borislav Petkov
Date: Mon Aug 21 2023 - 10:00:12 EST


On Sun, Aug 20, 2023 at 06:18:59PM -0700, Josh Poimboeuf wrote:
> Booting with mitigations=off incorrectly prevents the
> X86_FEATURE_{IBPB_BRTYPE,SBPB} CPUID bits from getting set.
>
> Also, future CPUs without X86_BUG_SRSO might still have IBPB with branch
> type prediction flushing, in which case SBPB should be used instead of
> IBPB. The current code doesn't allow for that.
>
> Also, cpu_has_ibpb_brtype_microcode() has some surprising side effects
> and the setting of these feature bits really doesn't belong in the
> mitigation code anyway. Move it to earlier.
>
> Fixes: fb3bd914b3ec ("x86/srso: Add a Speculative RAS Overflow mitigation")
> Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> ---
> arch/x86/include/asm/processor.h | 2 --
> arch/x86/kernel/cpu/amd.c | 28 +++++++++-------------------
> arch/x86/kernel/cpu/bugs.c | 13 +------------
> 3 files changed, 10 insertions(+), 33 deletions(-)

Reviewed-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette