Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/srso: Disable the mitigation on unaffected configurations

Skip the srso cmd line parsing which is not needed on Zen1/2 with SMT
disabled and with the proper microcode applied (latter should be the
case anyway) as those are not affected.

Fixes: 5a15d8348881 ("x86/srso: Tie SBPB bit setting to microcode patch detection")
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230813104517.3346-1-bp@alien8.de

+6 -1
+6 -1
arch/x86/kernel/cpu/bugs.c
··· 2418 2418 * IBPB microcode has been applied. 2419 2419 */ 2420 2420 if ((boot_cpu_data.x86 < 0x19) && 2421 - (!cpu_smt_possible() || (cpu_smt_control == CPU_SMT_DISABLED))) 2421 + (!cpu_smt_possible() || (cpu_smt_control == CPU_SMT_DISABLED))) { 2422 2422 setup_force_cpu_cap(X86_FEATURE_SRSO_NO); 2423 + return; 2424 + } 2423 2425 } 2424 2426 2425 2427 if (retbleed_mitigation == RETBLEED_MITIGATION_IBPB) { ··· 2698 2696 2699 2697 static ssize_t srso_show_state(char *buf) 2700 2698 { 2699 + if (boot_cpu_has(X86_FEATURE_SRSO_NO)) 2700 + return sysfs_emit(buf, "Not affected\n"); 2701 + 2701 2702 return sysfs_emit(buf, "%s%s\n", 2702 2703 srso_strings[srso_mitigation], 2703 2704 (cpu_has_ibpb_brtype_microcode() ? "" : ", no microcode"));