Re: [RFC PATCH v5 11/18] mm: Introduce kpkeys_hardened_pgtables

Kevin Brodsky
2025-12-01T09:19:53Z

On 28/11/2025 17:44, Yeoreum Yun wrote:
>> +int kpkeys_protect_pgtable_memory(struct folio *folio)
>> +{
>> + unsigned long addr = (unsigned long)folio_address(folio);
> I think it might need to use untagged_addr()?

I've never seen untagged_addr() used on folio_address()/page_address()
(see for instance set_direct_map_valid_noflush() and
__kernel_map_pages() in arch/arm64/mm/pageattr.c).

It does seem that page_to_virt() sets the tag if KASAN is enabled
though... I'm not sure what to think, is there a wider issue here? We
might just be lucky and the sort of pages that these functions are
called on don't have their KASAN tag set.

- Kevin