Skip to content

Commit 0205f8a

Browse files
Ricardo Cañuelosuryasaimadhu
authored andcommitted
x86/speculation/srbds: Do not try to turn mitigation off when not supported
When SRBDS is mitigated by TSX OFF, update_srbds_msr() will still read and write to MSR_IA32_MCU_OPT_CTRL even when that MSR is not supported due to not having loaded the appropriate microcode. Check for X86_FEATURE_SRBDS_CTRL which is set only when the respective microcode which adds MSR_IA32_MCU_OPT_CTRL is loaded. Based on a patch by Thadeu Lima de Souza Cascardo <[email protected]>. [ bp: Massage commit message. ] Suggested-by: Pawan Gupta <[email protected]> Signed-off-by: Ricardo Cañuelo <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f8858b5 commit 0205f8a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,13 @@ void update_srbds_msr(void)
446446
if (srbds_mitigation == SRBDS_MITIGATION_UCODE_NEEDED)
447447
return;
448448

449+
/*
450+
* A MDS_NO CPU for which SRBDS mitigation is not needed due to TSX
451+
* being disabled and it hasn't received the SRBDS MSR microcode.
452+
*/
453+
if (!boot_cpu_has(X86_FEATURE_SRBDS_CTRL))
454+
return;
455+
449456
rdmsrl(MSR_IA32_MCU_OPT_CTRL, mcu_ctrl);
450457

451458
switch (srbds_mitigation) {

0 commit comments

Comments
 (0)