Re: [PATCH v6 12/18] x86/mm: LAM compatible non-canonical definition
From: Alexander Potapenko
Date: Tue Nov 11 2025 - 04:13:30 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>
>
> For an address to be canonical it has to have its top bits equal to each
> other. The number of bits depends on the paging level and whether
> they're supposed to be ones or zeroes depends on whether the address
> points to kernel or user space.
>
> With Linear Address Masking (LAM) enabled, the definition of linear
> address canonicality is modified. Not all of the previously required
> bits need to be equal, only the first and last from the previously equal
> bitmask. So for example a 5-level paging kernel address needs to have
> bits [63] and [56] set.
>
> Change the canonical checking function to use bit masks instead of bit
> shifts.
>
> Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
Acked-by: Alexander Potapenko <glider@xxxxxxxxxx>