linux-stable/arch
Thomas Gleixner 41f4ff9fe2 x86/alternatives: Sync core before enabling interrupts
commit 3ea1704a92 upstream.

text_poke_early() does:

   local_irq_save(flags);
   memcpy(addr, opcode, len);
   local_irq_restore(flags);
   sync_core();

That's not really correct because the synchronization should happen before
interrupts are re-enabled to ensure that a pending interrupt observes the
complete update of the opcodes.

It's not entirely clear whether the interrupt entry provides enough
serialization already, but moving the sync_core() invocation into interrupt
disabled region does no harm and is obviously correct.

Fixes: 6fffacb303 ("x86/alternatives, jumplabel: Use text_poke_early() before mm_init()")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: <stable@kernel.org>
Link: https://lore.kernel.org/r/ZT6narvE%2BLxX%2B7Be@windriver.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-01-01 12:39:08 +00:00
..
alpha
arc
arm ARM: OMAP2+: Fix null pointer dereference and memory leak in omap_soc_device_init 2024-01-01 12:38:53 +00:00
arm64 KVM: arm64: vgic: Force vcpu vgic teardown on vcpu destroy 2024-01-01 12:39:08 +00:00
csky
hexagon
ia64
loongarch LoongArch: Implement constant timer shutdown interface 2023-12-20 17:00:23 +01:00
m68k
microblaze
mips MIPS: Loongson64: Enable DMA noncoherent support 2023-12-13 18:39:29 +01:00
nios2
openrisc
parisc parisc: Fix asm operand number out of range build error in bug table 2023-12-13 18:39:24 +01:00
powerpc powerpc/ftrace: Fix stack teardown in ftrace_no_trace 2023-12-20 17:00:14 +01:00
riscv RISC-V: Fix do_notify_resume / do_work_pending prototype 2024-01-01 12:39:05 +00:00
s390 s390/vx: fix save/restore of fpu kernel context 2024-01-01 12:38:53 +00:00
sh sh: bios: Revive earlyprintk support 2023-11-20 11:52:07 +01:00
sparc sparc32: fix a braino in fault handling in csum_and_copy_..._user() 2023-11-02 09:35:32 +01:00
um
x86 x86/alternatives: Sync core before enabling interrupts 2024-01-01 12:39:08 +00:00
xtensa
.gitignore
Kconfig