Re: [PATCH v10 10/13] x86/mm: Initialize LAM_SUP
From: Dave Hansen
Date: Mon Feb 23 2026 - 15:43:32 EST
On 2/4/26 11:20, Maciej Wieczor-Retman 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.
I don't think we need to know the bit number in the changelog.
> Set the bit in early memory initialization.
Why does it need to be done early?
> 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.
Why does it get lost? Is it special somehow or is this normal for the
other CR4 bits? It sounds like it is normal, so let's lead with that.