Re: [PATCH] x86/alternative: delay freeing of smp_locks section

From: Borislav Petkov

Date: Sat Mar 28 2026 - 07:42:14 EST


On Sat, Mar 28, 2026 at 11:16:34AM +0300, Mike Rapoport wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx>
>
> On UP systems alternative_instructions() frees memory occupied by smp_locks

UP systems?

I don't understand - Bert's machine is a SMP.

> section immediately after patching the lock instructions.
>
> With CONFIG_DEFERRED_STRUCT_PAGE_INIT enabled this happens before the
> memory map is fully initialized and the struct pages representing the freed
> memory might get overwritten by deferred initialization of the memory map.
>
> Move freeing of smp_locks section to an initcall to ensure it will happen
> after the memory map is fully initialized.
>
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
> Tested-By: Bert Karwatzki <spasswolf@xxxxxx>

I don't understand even more: why have we not hit this before?

No Fixes: tag?

Something must've changed for this to fire...

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette