Skip to content

Commit 3ea1704

Browse files
KAGA-KOKObp3tk0v
authored andcommitted
x86/alternatives: Sync core before enabling interrupts
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: 6fffacb ("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
1 parent 69a7386 commit 3ea1704

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/alternative.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1685,8 +1685,8 @@ void __init_or_module text_poke_early(void *addr, const void *opcode,
16851685
} else {
16861686
local_irq_save(flags);
16871687
memcpy(addr, opcode, len);
1688-
local_irq_restore(flags);
16891688
sync_core();
1689+
local_irq_restore(flags);
16901690

16911691
/*
16921692
* Could also do a CLFLUSH here to speed up CPU recovery; but

0 commit comments

Comments
 (0)