From: Mike Rapoport <rppt@kernel.org>
To: Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org, Bert Karwatzki <spasswolf@web.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/alternative: delay freeing of smp_locks section
Date: Sat, 28 Mar 2026 15:39:15 +0300 [thread overview]
Message-ID: <acfL88Nfpfkf8rCy@kernel.org> (raw)
In-Reply-To: <20260328114118.GAace-Xu8bEKacpCtZ@fat_crate.local>
On Sat, Mar 28, 2026 at 12:41:18PM +0100, Borislav Petkov wrote:
> On Sat, Mar 28, 2026 at 11:16:34AM +0300, Mike Rapoport wrote:
> > From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
> >
> > On UP systems alternative_instructions() frees memory occupied by smp_locks
>
> UP systems?
>
> I don't understand - Bert's machine is a SMP.
Argh, I misread the 'if (!uniproc_patched' :(
> > 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@kernel.org>
> > Tested-By: Bert Karwatzki <spasswolf@web.de>
>
> I don't understand even more: why have we not hit this before?
That memory was never actually freed, it remained reserved because
free_init_pages() calls free_reserved_area() but does not update memblock.
> No Fixes: tag?
It's as old as CONFIG_DEFERRED_STRUCT_PAGE_INIT (v4.2) or even before that.
If you think that fixing this leak is important enough to backport, it
affects all mainlined stable releases.
> Something must've changed for this to fire...
Yes, I added a WARN() in free_reserved_area() to lure such cases and
prevent them in the future.
I'll wait a bit for more comments before rewriting changelog and reposting.
> --
> Regards/Gruss,
> Boris.
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2026-03-28 12:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-28 8:16 [PATCH] x86/alternative: delay freeing of smp_locks section Mike Rapoport
2026-03-28 11:41 ` Borislav Petkov
2026-03-28 12:39 ` Mike Rapoport [this message]
2026-03-28 19:58 ` Borislav Petkov
2026-03-30 17:16 ` Mike Rapoport
2026-03-30 17:44 ` Borislav Petkov
2026-03-30 19:36 ` Peter Zijlstra
2026-03-30 19:43 ` H. Peter Anvin
2026-03-30 20:20 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=acfL88Nfpfkf8rCy@kernel.org \
--to=rppt@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=spasswolf@web.de \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.