Re: [PATCH v4 01/15] arm64: mm: Map the linear alias of text/rodata as tagged

Ard Biesheuvel
2026-04-29T07:58:39Z

On Wed, 29 Apr 2026, at 09:57, Kevin Brodsky wrote:
> On 28/04/2026 18:23, Ard Biesheuvel wrote:
>> Hi Kevin,
>>
>> On Tue, 28 Apr 2026, at 16:16, Kevin Brodsky wrote:
>>> On 27/04/2026 17:34, Ard Biesheuvel wrote:
>>>> From: Ard Biesheuvel <ardb@kernel.org>
>>>>
>>>> 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).
>>>
>> I see. I guess we should probably update both, no?
>
> We could, but would we ever access the tags in data mapped read-only?
> cpu_enable_mte() needs tag access to zero them, but AFAIU it's really a
> special case that is only relevant to the situation where the data is RW.
>

Right, that makes sense.