Skip to content

Commit b056346

Browse files
andyhhpbp3tk0v
authored andcommitted
x86/CPU/AMD: Disable XSAVES on AMD family 0x17
AMD Erratum 1386 is summarised as: XSAVES Instruction May Fail to Save XMM Registers to the Provided State Save Area This piece of accidental chronomancy causes the %xmm registers to occasionally reset back to an older value. Ignore the XSAVES feature on all AMD Zen1/2 hardware. The XSAVEC instruction (which works fine) is equivalent on affected parts. [ bp: Typos, move it into the F17h-specific function. ] Reported-by: Tavis Ormandy <taviso@gmail.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Cc: <stable@kernel.org> Link: https://lore.kernel.org/r/20230307174643.1240184-1-andrew.cooper3@citrix.com
1 parent fe15c26 commit b056346

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

arch/x86/kernel/cpu/amd.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,15 @@ void init_spectral_chicken(struct cpuinfo_x86 *c)
880880
}
881881
}
882882
#endif
883+
/*
884+
* Work around Erratum 1386. The XSAVES instruction malfunctions in
885+
* certain circumstances on Zen1/2 uarch, and not all parts have had
886+
* updated microcode at the time of writing (March 2023).
887+
*
888+
* Affected parts all have no supervisor XSAVE states, meaning that
889+
* the XSAVEC instruction (which works fine) is equivalent.
890+
*/
891+
clear_cpu_cap(c, X86_FEATURE_XSAVES);
883892
}
884893

885894
static void init_amd_zn(struct cpuinfo_x86 *c)

0 commit comments

Comments
 (0)