[PATCH RFC v9 02/25] set_memory: Introduce set_memory_pkey() stub

Kevin Brodsky kevin.brodsky at arm.com
Mon Sep 7 08:57:24 PDT 2026


On 07/09/2026 15:36, Linu Cherian wrote:
>>>> Introduce a new function, set_memory_pkey(), which sets the
>>>> protection key (pkey) of pages in the specified linear mapping
>>>> range. Architectures implementing kernel pkeys (kpkeys) must
>>>> provide a suitable implementation; an empty stub is added as
>>> Could you make it explicit here why we are restricting this only
>>> to the linear mapping range ? Would be helpful to add the reasoning
>>> in the commit message and as comments.
>>>
>>> Essentially we are also making a assumption here that there are no
>>> aliases to the linear map ?
>> We're not assuming this, this function is called on pages that are also
>> mapped as part of the kernel image. But indeed it ignores aliases,
>> unlike e.g. set_memory_ro(). Really its name is wrong as discussed below.
> Just trying to understand, does it also imply that we dont have use cases that has aliases.

We don't need to change the pkey of mappings outside the direct map for
protecting page tables, at least not yet. They are almost always
accessed via the direct map, but as Ard's recent series [1] shows, there
are exceptions.

- Kevin

[1]
https://lore.kernel.org/all/20260827164409.3421848-6-ardb+git@google.com/



More information about the linux-arm-kernel mailing list