[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 2/5] x86/mm/kaslr: Allow memory regions to be randomized before setup_arch()



On Mon, Nov 30, 2026 at 03:36:47PM +0100, Teddy Astie wrote:
> kernel_randomize_memory() is called from setup_arch(), which works
> because on bare metal, the direct map is only populated on demand by
> the early page fault handler until init_mem_mapping().
> 
> This isn't the case for Xen PV, where the direct map is built early
> in xen_start_kernel() and used right away, so the regions need to be
> randomized before that.
> 
> Make kernel_randomize_memory() a no-op once the regions have been
> randomized, so that an early caller isn't overridden by setup_arch().
> Warn if the direct map region turns out to be too small for the final
> max_pfn.

Do not explain the diff in your commit message.

> Signed-off-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
> Assisted-by: LLM

We don't use that tag anymore.

And since you're using AI, ask it to throw this clumsy version with a static
bool into its virtual trash can and to try again.

It can try again and be more elegant. Dunno, perhaps gate the
kernel_randomize_memory() call in setup_arch() using X86_FEATURE_XENPV or
whatever else CONFIG gunk we use nowadays for this type of
Xen-something-guest-type and put a comment ontop why we're doing that.

For example.

And I'm open to even better suggestions. Who knows, it might surprise us.

Thx.

-- 
Regards/Gruss,
    Boris.

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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.