Re: [PATCH v6 13/18] x86/mm: LAM initialization
From: Alexander Potapenko
Date: Tue Nov 11 2025 - 04:10:17 EST
On Wed, Oct 29, 2025 at 9:08 PM Maciej Wieczor-Retman
<m.wieczorretman@xxxxx> wrote:
>
> From: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
>
> To make use of KASAN's tag based mode on x86, Linear Address Masking
> (LAM) needs to be enabled. To do that the 28th bit in CR4 has to be set.
>
> Set the bit in early memory initialization.
>
> When launching secondary CPUs the LAM bit gets lost. To avoid this add
> it in a mask in head_64.S. The bitmask permits some bits of CR4 to pass
> from the primary CPU to the secondary CPUs without being cleared.
>
> Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
Acked-by: Alexander Potapenko <glider@xxxxxxxxxx>