lkml.org 
[lkml]   [2023]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH RFC v2 19/27] mm: mprotect: Introduce PAGE_FAULT_ON_ACCESS for mprotect(PROT_MTE)
From
On 19.11.23 17:57, Alexandru Elisei wrote:
> To enable tagging on a memory range, userspace can use mprotect() with the
> PROT_MTE access flag. Pages already mapped in the VMA don't have the
> associated tag storage block reserved, so mark the PTEs as
> PAGE_FAULT_ON_ACCESS to trigger a fault next time they are accessed, and
> reserve the tag storage on the fault path.

That sounds alot like fake PROT_NONE. Would there be a way to unify hat
handling and simply reuse pte_protnone()? For example, could we special
case on VMA flags?

Like, don't do NUMA hinting in these special VMAs. Then, have something
like:

if (pte_protnone(vmf->orig_pte))
return handle_pte_protnone(vmf);

In there, special case on the VMA flags.

I *suspect* that handle_page_missing_tag_storage() stole (sorry :P) some
code from the prot_none handling path. At least the recovery path and
writability handling looks like it better be located shared in
handle_pte_protnone() as well.

That might take some magic out of this patch.

--
Cheers,

David / dhildenb

\
 
 \ /
  Last update: 2023-11-28 18:57    [W:0.408 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site