]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/srso: Tie SBPB bit setting to microcode patch detection
authorBorislav Petkov (AMD) <bp@alien8.de>
Mon, 7 Aug 2023 08:46:04 +0000 (10:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Aug 2023 17:58:34 +0000 (19:58 +0200)
commit153f9a7b02d4f292671e81077e901ef01e123a9f
tree5ada94a7ae793fd7ce747de1274d99c7395e5d6a
parentdf4c3823cba5c43e2321eface8501bfafe76d0d9
x86/srso: Tie SBPB bit setting to microcode patch detection

commit 5a15d8348881e9371afdf9f5357a135489496955 upstream.

The SBPB bit in MSR_IA32_PRED_CMD is supported only after a microcode
patch has been applied so set X86_FEATURE_SBPB only then. Otherwise,
guests would attempt to set that bit and #GP on the MSR write.

While at it, make SMT detection more robust as some guests - depending
on how and what CPUID leafs their report - lead to cpu_smt_control
getting set to CPU_SMT_NOT_SUPPORTED but SRSO_NO should be set for any
guest incarnation where one simply cannot do SMT, for whatever reason.

Fixes: fb3bd914b3ec ("x86/srso: Add a Speculative RAS Overflow mitigation")
Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reported-by: Salvatore Bonaccorso <carnil@debian.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/bugs.c