Re: [PATCH] mm/madvise: disallow guard region installation in uffd-armed VMAs

From: David Hildenbrand (Arm)

Date: Thu Nov 12 2026 - 21:40:28 EST


On 11/12/26 18:38, Lorenzo Stoakes (ARM) wrote:
> In order to establish guard regions, guard markers are installed in the
> page tables of a mapped VMA.
>
> However, problems arise when one tries to combine this with registering a
> VMA for userfaultfd, as such operations may themselves need to install page
> table markers such as uffd-wp.

How does this interact with UFFDIO_POISON markers that can outlive even
userfaultfd registration?

I'd assume it's just the same thing, just like having proper hwpoison marker in
anon mappings, so it just works (uffd-wp will skip, guard installation will zap).

>
> When this installation is attempted the guard marker prevents these markers
> being applied, which can lead to unexpected results (especially if the
> guard regions are later removed.)
>
> This is especially problematic because guard region installation causes the
> regions to be zapped first, meaning that the removal of userfaultfd-tracked
> ranges will not be logged in this case.

Again, similar to trying to uffd-wp-protect'ing a hwpoison marker (which will be
ignored), and then zapping that.

Isn't guard marker installation/removal just another form of zapping?

So to me this all sounds like "if user space does something stupid, it's user
space's fault".

>
> Therefore, disallow this.
>
> This makes sense as conceptually, guard regions mark a part of a VMA as
> effectively unmapped at the page table level, and removing the markers is
> like mapping the VMA again, over which operation uffd markers would in any
> case be lost.

Right, but that to me just says "on the parts of the VMA where you mess with
guard markers, your uffd-wp protection is similarly ignored".

So disallowing it entirely for a VMA, I am not sure. I could see use cases for
that, although you might argue that user space should then register uffd-wp on
the separate pieces. But then you get multiple VMAs again.


--
Cheers,

David