On 4/7/2026 10:45 AM, Maciej Wieczor-Retman wrote:

> diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
> index 08e72f429870..1a0e96835bbc 100644
> --- a/arch/x86/kernel/process_64.c
> +++ b/arch/x86/kernel/process_64.c
> @@ -797,7 +797,7 @@ static long prctl_map_vdso(const struct vdso_image 
> *image, unsigned long addr)
>  
>  #ifdef CONFIG_ADDRESS_MASKING
>  
> -#define LAM_U57_BITS 6
> +#define LAM_DEFAULT_BITS     4
>  

As Dave mentioned earlier, the default wording makes it seem like this
can be configured. But that isn't true anymore, right?

How about naming this as LAM_TAG_BITS to match ARCH_GET_MAX_TAG_BITS?

>  static void enable_lam_func(void *__mm)
>  {
> @@ -814,7 +814,7 @@ static void enable_lam_func(void *__mm)
>  static void mm_enable_lam(struct mm_struct *mm)
>  {
>       mm->context.lam_cr3_mask = X86_CR3_LAM_U57;
> -     mm->context.untag_mask =  ~GENMASK(62, 57);
> +     mm->context.untag_mask =  ~GENMASK(57 + LAM_DEFAULT_BITS - 1, 57);
>  

Also, would it be useful to calculate the LAM mask as a #define because
it might need to be reused later or copied over to the selftest (as in
patch 3)?



Reply via email to