Re: [PATCH] x86/mm: Do not shuffle CPU entry areas without KASLR

From: Dave Hansen
Date: Fri Mar 03 2023 - 16:25:21 EST


On 3/3/23 08:06, Michal Koutný wrote:
> @@ -29,6 +30,12 @@ static __init void init_cea_offsets(void)
> unsigned int max_cea;
> unsigned int i, j;
>
> + if (!kaslr_memory_enabled()) {
> + for_each_possible_cpu(i)
> + per_cpu(_cea_offset, i) = i;
> + return;
> + }

Should this be kaslr_memory_enabled() or kaslr_enabled()?

The delta seems to be CONFIG_KASAN, and the cpu entry area randomization
works just fine with KASAN after some recent fixes. I _think_ that
makes cpu entry area randomization more like module randomization which
would point toward kaslr_enabled().