Skip to content

Commit 02428d0

Browse files
jpoimboebp3tk0v
authored andcommitted
x86/srso: Don't probe microcode in a guest
To support live migration, the hypervisor sets the "lowest common denominator" of features. Probing the microcode isn't allowed because any detected features might go away after a migration. As Andy Cooper states: "Linux must not probe microcode when virtualised.  What it may see instantaneously on boot (owing to MSR_PRED_CMD being fully passed through) is not accurate for the lifetime of the VM." Rely on the hypervisor to set the needed IBPB_BRTYPE and SBPB bits. Fixes: 1b5277c ("x86/srso: Add SRSO_NO support") Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/3938a7209606c045a3f50305d201d840e8c834c7.1693889988.git.jpoimboe@kernel.org
1 parent 91857ae commit 02428d0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/cpu/amd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ static void early_init_amd(struct cpuinfo_x86 *c)
767767
if (cpu_has(c, X86_FEATURE_TOPOEXT))
768768
smp_num_siblings = ((cpuid_ebx(0x8000001e) >> 8) & 0xff) + 1;
769769

770-
if (!cpu_has(c, X86_FEATURE_IBPB_BRTYPE)) {
770+
if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && !cpu_has(c, X86_FEATURE_IBPB_BRTYPE)) {
771771
if (c->x86 == 0x17 && boot_cpu_has(X86_FEATURE_AMD_IBPB))
772772
setup_force_cpu_cap(X86_FEATURE_IBPB_BRTYPE);
773773
else if (c->x86 >= 0x19 && !wrmsrl_safe(MSR_IA32_PRED_CMD, PRED_CMD_SBPB)) {

0 commit comments

Comments
 (0)