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

Yeoreum Yun
2025-11-28T16:45:26Z

Hi Kevin,

[...]
> +
> +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()?

> + unsigned int order = folio_order(folio);
> + int ret = 0;
> +
> + if (kpkeys_hardened_pgtables_enabled())
> + ret = set_memory_pkey(addr, 1 << order, KPKEYS_PKEY_PGTABLES);
> +
> + WARN_ON(ret);
> + return ret;
> +}
> +
> +int kpkeys_unprotect_pgtable_memory(struct folio *folio)
> +{
> + unsigned long addr = (unsigned long)folio_address(folio);

Same here.

[...]

Thanks.

--
Sincerely,
Yeoreum Yun