On 27/04/2026 17:34, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <[email protected]>
>
> Before moving the empty_zero_page into the __ro_after_init section, make
> sure it has the memory-tagged type. This is needed to ensure that
> cpu_enable_mte() will be able to initialize the tags correctly.

mark_linear_text_alias_ro() is called after all features have been
detected and enabled, so do we actually need this?

AFAICT the lines that matter for cpu_enable_mte() are those, in map_mem():

    __map_memblock(pgdp, kernel_start, kernel_end,
               PAGE_KERNEL, NO_CONT_MAPPINGS);

It is probably this call that needs to be changed to use
pgprot_tagged(PAGE_KERNEL).

- Kevin

> Signed-off-by: Ard Biesheuvel <[email protected]>
> ---
>  arch/arm64/mm/mmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index dd85e093ffdb..f084993024ab 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -1049,7 +1049,7 @@ void __init mark_linear_text_alias_ro(void)
>        */
>       update_mapping_prot(__pa_symbol(_text), (unsigned long)lm_alias(_text),
>                           (unsigned long)__init_begin - (unsigned long)_text,
> -                         PAGE_KERNEL_RO);
> +                         pgprot_tagged(PAGE_KERNEL_RO));
>  }
>  
>  #ifdef CONFIG_KFENCE

Reply via email to