linux/arch/x86/kernel
Borislav Petkov 0fb04676c4 x86/microcode/AMD: Apply the patch early on every logical thread
commit e7ad18d116 upstream.

Currently, the patch application logic checks whether the revision
needs to be applied on each logical CPU (SMT thread). Therefore, on SMT
designs where the microcode engine is shared between the two threads,
the application happens only on one of them as that is enough to update
the shared microcode engine.

However, there are microcode patches which do per-thread modification,
see Link tag below.

Therefore, drop the revision check and try applying on each thread. This
is what the BIOS does too so this method is very much tested.

Btw, change only the early paths. On the late loading paths, there's no
point in doing per-thread modification because if is it some case like
in the bugzilla below - removing a CPUID flag - the kernel cannot go and
un-use features it has detected are there early. For that, one should
use early loading anyway.

  [ bp: Fixes does not contain the oldest commit which did check for
    equality but that is good enough. ]

Fixes: 8801b3fcb5 ("x86/microcode/AMD: Rework container parsing")
Reported-by:  Ștefan Talpalaru <stefantalpalaru@yahoo.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Tested-by:  Ștefan Talpalaru <stefantalpalaru@yahoo.com>
Cc: <stable@vger.kernel.org>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216211
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-30 09:41:15 +01:00
..
acpi x86: Prepare asm files for straight-line-speculation 2022-07-25 11:26:28 +02:00
apic x86: Fix return value of __setup handlers 2022-06-09 10:21:05 +02:00
cpu x86/microcode/AMD: Apply the patch early on every logical thread 2022-10-30 09:41:15 +01:00
fpu x86/fpu: Limit xstate copy size in xstateregs_set() 2021-07-20 16:05:52 +02:00
kprobes x86: Prepare inline-asm for straight-line-speculation 2022-07-25 11:26:29 +02:00
.gitignore
alternative.c x86/alternative: Fix race in try_get_desc() 2022-10-05 10:38:43 +02:00
amd_gart_64.c dma-mapping: split <linux/dma-mapping.h> 2020-10-06 07:07:03 +02:00
amd_nb.c
apb_timer.c
aperture_64.c
apm_32.c
asm-offsets_32.c
asm-offsets_64.c x86/pv: Switch SWAPGS to ALTERNATIVE 2021-12-08 09:03:27 +01:00
asm-offsets.c x86: remove address space overrides using set_fs() 2020-09-08 22:21:36 -04:00
audit_64.c
bootflag.c
cc_platform.c x86/sev: Add an x86 version of cc_platform_has() 2021-11-18 14:04:32 +01:00
check.c
cpuid.c
crash_core_32.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
crash_core_64.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
crash_dump_32.c
crash_dump_64.c
crash.c x86/crash: Fix crash_setup_memmap_entries() out-of-bounds access 2021-04-28 13:40:02 +02:00
devicetree.c x86_ioapic_Consolidate_IOAPIC_allocation 2020-09-16 16:52:32 +02:00
doublefault_32.c x86/entry: Convert double fault exception to IDTENTRY_DF 2020-06-11 15:15:03 +02:00
dumpstack_32.c
dumpstack_64.c x86/dumpstack/64: Add noinstr version of get_stack_info() 2020-09-09 11:33:19 +02:00
dumpstack.c x86/dumpstack: Do not try to access user space code of other tasks 2020-11-18 12:56:29 +01:00
e820.c x86/boot: Fix memremap of setup_indirect structures 2022-03-16 14:16:02 +01:00
early_printk.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
early-quirks.c x86/gpu: Reserve stolen memory for first integrated Intel GPU 2022-01-27 10:53:41 +01:00
ebda.c
eisa.c
espfix_64.c mm: introduce include/linux/pgtable.h 2020-06-09 09:39:13 -07:00
ftrace_32.S x86: Prepare asm files for straight-line-speculation 2022-07-25 11:26:28 +02:00
ftrace_64.S x86/ibt,ftrace: Make function-graph play nice 2022-09-20 12:38:33 +02:00
ftrace.c x86/ftrace: Use alternative RET encoding 2022-09-20 12:38:33 +02:00
head_32.S x86/asm/32: Fix ANNOTATE_UNRET_SAFE use on 32-bit 2022-07-25 11:26:53 +02:00
head_64.S objtool: Add entry UNRET validation 2022-07-25 11:26:45 +02:00
head32.c
head64.c x86: Clear .brk area at early boot 2022-07-21 21:20:17 +02:00
hpet.c x86/hpet: Use another crystalball to evaluate HPET usability 2021-10-13 10:04:30 +02:00
hw_breakpoint.c x86/debug: Prevent data breakpoints on cpu_dr7 2021-02-10 09:29:22 +01:00
i8237.c
i8253.c
i8259.c x86/i8259: Use printk_deferred() to prevent deadlock 2020-07-29 16:27:16 +02:00
idt.c This feature enhances the current guest memory encryption support 2020-10-14 10:21:34 -07:00
ima_arch.c ima: force signature verification when CONFIG_KEXEC_SIG is configured 2022-07-21 21:20:11 +02:00
io_delay.c
ioport.c x86/ioperm: Prevent a memory leak when fork fails 2020-05-28 21:36:20 +02:00
irq_32.c x86/irq: Rework handle_irq() for 64-bit 2020-06-11 15:15:12 +02:00
irq_64.c x86/irq: Make run_on_irqstack_cond() typesafe 2020-09-22 22:13:34 +02:00
irq_work.c x86/entry: Convert various system vectors 2020-06-11 15:15:14 +02:00
irq.c x86/irq: Ensure PI wakeup handler is unregistered before module unload 2021-11-18 14:03:41 +01:00
irqflags.S x86: Prepare asm files for straight-line-speculation 2022-07-25 11:26:28 +02:00
irqinit.c x86/headers: Remove APIC headers from <asm/smp.h> 2020-08-06 16:13:09 +02:00
itmt.c
jailhouse.c locking/seqlock, headers: Untangle the spaghetti monster 2020-08-06 16:13:13 +02:00
jump_label.c
kdebugfs.c x86/boot: Fix memremap of setup_indirect structures 2022-03-16 14:16:02 +01:00
kexec-bzimage64.c x86/kexec: Use up-to-dated screen_info copy to fill boot params 2020-10-14 17:05:03 +02:00
kgdb.c x86/debug: Change thread.debugreg6 to thread.virtual_dr6 2020-09-04 15:12:58 +02:00
ksysfs.c x86/boot: Fix memremap of setup_indirect structures 2022-03-16 14:16:02 +01:00
kvm.c x86, kvm: use proper ASM macros for kvm_vcpu_is_preempted 2022-07-25 11:26:52 +02:00
kvmclock.c x86/kvmclock: Move this_cpu_pvti into kvmclock.h 2021-10-06 15:55:48 +02:00
ldt.c x86/ldt: use "pr_info_once()" instead of open-coding it badly 2020-07-05 12:50:20 -07:00
machine_kexec_32.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
machine_kexec_64.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
Makefile x86/sev: Add an x86 version of cc_platform_has() 2021-11-18 14:04:32 +01:00
mmconf-fam10h_64.c
module.c x86: Undo return-thunk damage 2022-07-25 11:26:36 +02:00
mpparse.c Surgery of the MSI interrupt handling to prepare the support of upcoming 2020-10-12 11:40:41 -07:00
msr.c x86/MSR: Filter MSR writes through X86_IOC_WRMSR_REGS ioctl too 2021-03-04 11:37:26 +01:00
nmi_selftest.c
nmi.c KVM/VMX: Invoke NMI non-IST entry instead of IST entry 2021-05-19 10:12:51 +02:00
paravirt_patch.c x86/pv: Switch SWAPGS to ALTERNATIVE 2021-12-08 09:03:27 +01:00
paravirt-spinlocks.c
paravirt.c x86: Prepare inline-asm for straight-line-speculation 2022-07-25 11:26:29 +02:00
pci-dma.c dma-mapping: move dma-debug.h to kernel/dma/ 2020-10-06 07:07:05 +02:00
pci-iommu_table.c
pci-swiotlb.c
pcspeaker.c
perf_regs.c perf/arch: Remove perf_sample_data::regs_user_copy 2020-11-09 18:12:34 +01:00
platform-quirks.c
pmem.c x86/pmem: Fix platform-device leak in error path 2022-08-21 15:15:33 +02:00
probe_roms.c maccess: make get_kernel_nofault() check for minimal type compatibility 2020-06-18 12:10:37 -07:00
process_32.c x86/fpu: Correct pkru/xstate inconsistency 2022-03-02 11:42:47 +01:00
process_64.c x86/fpu: Correct pkru/xstate inconsistency 2022-03-02 11:42:47 +01:00
process.c x86: Handle idle=nomwait cmdline properly for x86_idle 2022-08-21 15:15:28 +02:00
process.h
ptrace.c x86/debug: Change thread.debugreg6 to thread.virtual_dr6 2020-09-04 15:12:58 +02:00
pvclock.c
quirks.c x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
reboot_fixups_32.c
reboot.c x86/mm: Flush global TLB when switching to trampoline page-table 2022-01-27 10:54:14 +01:00
relocate_kernel_32.S x86/kexec: Disable RET on kexec 2022-07-25 11:26:51 +02:00
relocate_kernel_64.S x86/kexec: Disable RET on kexec 2022-07-25 11:26:51 +02:00
resource.c
rtc.c
setup_percpu.c x86/mm: remove vmalloc faulting 2020-06-02 10:59:12 -07:00
setup.c x86/boot: Fix memremap of setup_indirect structures 2022-03-16 14:16:02 +01:00
sev_verify_cbit.S x86: Prepare asm files for straight-line-speculation 2022-07-25 11:26:28 +02:00
sev-es-shared.c x86/sev: Return an error on a returned non-zero SW_EXITINFO1[31:0] 2021-10-13 10:04:30 +02:00
sev-es.c x86/insn: Rename insn_decode() to insn_decode_from_regs() 2022-07-25 11:26:10 +02:00
signal_compat.c arm64: mte: Add specific SIGSEGV codes 2020-09-04 12:46:06 +01:00
signal.c x86/signal: Detect and prevent an alternate signal stack overflow 2021-07-20 16:05:50 +02:00
smp.c x86/entry: Convert reschedule interrupt to IDTENTRY_SYSVEC_SIMPLE 2020-06-11 15:15:16 +02:00
smpboot.c sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
stacktrace.c stacktrace: Remove reliable argument from arch_stack_walk() callback 2020-09-18 14:24:16 +01:00
static_call.c x86/static_call: Serialize __static_call_fixup() properly 2022-07-25 11:26:51 +02:00
step.c ptrace: Reimplement PTRACE_KILL by always sending SIGKILL 2022-06-09 10:20:49 +02:00
sys_ia32.c x86: switch to kernel_clone() 2020-08-20 13:12:58 +02:00
sys_x86_64.c x86/mm: Cleanup the control_va_addr_alignment() __setup handler 2022-06-09 10:21:06 +02:00
sysfb_efi.c
sysfb_simplefb.c
sysfb.c
tboot.c mm/gup: prevent gup_fast from racing with COW during fork 2020-12-30 11:53:54 +01:00
time.c A set of fixes and updates for x86: 2020-06-11 15:54:31 -07:00
tls.c x86: switch to ->regset_get() 2020-07-27 14:31:07 -04:00
tls.h x86: switch to ->regset_get() 2020-07-27 14:31:07 -04:00
topology.c x86/headers: Remove APIC headers from <asm/smp.h> 2020-08-06 16:13:09 +02:00
trace_clock.c
tracepoint.c x86/entry: Convert reschedule interrupt to IDTENTRY_SYSVEC_SIMPLE 2020-06-11 15:15:16 +02:00
traps.c x86/traps: Mark do_int3() NOKPROBE_SYMBOL 2022-03-16 14:16:03 +01:00
tsc_msr.c Misc fixes and small updates all around the place: 2020-08-15 10:38:03 -07:00
tsc_sync.c x86/tsc: Add a timer to make sure TSC_adjust is always checked 2021-12-08 09:03:28 +01:00
tsc.c clocksource: Reduce clocksource-skew threshold 2022-01-27 10:54:05 +01:00
umip.c x86/insn: Rename insn_decode() to insn_decode_from_regs() 2022-07-25 11:26:10 +02:00
unwind_frame.c fork-v5.9 2020-08-04 14:47:45 -07:00
unwind_guess.c
unwind_orc.c x86/unwind/orc: Unwind ftrace trampolines with correct ORC entry 2022-08-31 17:15:22 +02:00
uprobes.c x86/uprobes: Do not use prefixes.nbytes when looping over prefixes.bytes 2020-12-06 09:58:13 +01:00
verify_cpu.S x86: Prepare asm files for straight-line-speculation 2022-07-25 11:26:28 +02:00
vm86_32.c mmap locking API: use coccinelle to convert mmap_sem rwsem call sites 2020-06-09 09:39:14 -07:00
vmlinux.lds.S x86: Add magic AMD return-thunk 2022-07-25 11:26:40 +02:00
vsmp_64.c
x86_init.c x86/irq: Cleanup the arch_*_msi_irqs() leftovers 2020-09-16 16:52:38 +02:00