From: Greg Kroah-Hartman Date: Sat, 30 Dec 2023 11:05:09 +0000 (+0000) Subject: 5.4-stable patches X-Git-Tag: v6.1.70~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19163233be9506b813de9ed82123a735adf94fa2;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: x86-alternatives-sync-core-before-enabling-interrupts.patch --- diff --git a/queue-5.4/series b/queue-5.4/series index b25a5d73b81..9b4db0b70c2 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -38,3 +38,4 @@ usb-serial-option-add-quectel-rm500q-r13-firmware-support.patch bluetooth-hci_event-fix-not-checking-if-hci_op_inquiry-has-been-sent.patch net-9p-avoid-freeing-uninit-memory-in-p9pdu_vreadf.patch net-rfkill-gpio-set-gpio-direction.patch +x86-alternatives-sync-core-before-enabling-interrupts.patch diff --git a/queue-5.4/x86-alternatives-sync-core-before-enabling-interrupts.patch b/queue-5.4/x86-alternatives-sync-core-before-enabling-interrupts.patch new file mode 100644 index 00000000000..300097cc73b --- /dev/null +++ b/queue-5.4/x86-alternatives-sync-core-before-enabling-interrupts.patch @@ -0,0 +1,47 @@ +From 3ea1704a92967834bf0e64ca1205db4680d04048 Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Thu, 7 Dec 2023 20:49:24 +0100 +Subject: x86/alternatives: Sync core before enabling interrupts + +From: Thomas Gleixner + +commit 3ea1704a92967834bf0e64ca1205db4680d04048 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: 6fffacb30349 ("x86/alternatives, jumplabel: Use text_poke_early() before mm_init()") +Signed-off-by: Thomas Gleixner +Signed-off-by: Borislav Petkov (AMD) +Acked-by: Peter Zijlstra (Intel) +Cc: +Link: https://lore.kernel.org/r/ZT6narvE%2BLxX%2B7Be@windriver.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kernel/alternative.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/kernel/alternative.c ++++ b/arch/x86/kernel/alternative.c +@@ -772,8 +772,8 @@ void __init_or_module text_poke_early(vo + } else { + local_irq_save(flags); + memcpy(addr, opcode, len); +- local_irq_restore(flags); + sync_core(); ++ local_irq_restore(flags); + + /* + * Could also do a CLFLUSH here to speed up CPU recovery; but