Re: [PATCH] mm/memory: Fix missing pte marker for !page on pte zaps

David Hildenbrand
2024-03-13T22:26:30Z

On 13.03.24 23:03, David Hildenbrand wrote:
> On 13.03.24 22:31, peterx@redhat.com wrote:
>> From: Peter Xu <peterx@redhat.com>
>>
>> Commit 0cf18e839f64 of large folio zap work broke uffd-wp. Now mm's uffd
>> unit test "wp-unpopulated" will trigger this WARN_ON_ONCE().
>
> Good that I added the WARN_ON_ONCE() :)
>
>>
>> The WARN_ON_ONCE() asserts that an VMA cannot be registered with
>> userfaultfd-wp if it contains a !normal page, but it's actually possible.
>> One example is an anonymous vma, register with uffd-wp, read anything will
>> install a zero page. Then when zap on it, this should trigger.
>
> Are you sure? zap_install_uffd_wp_if_needed() contains right at the start:
>
> /* Zap on anonymous always means dropping everything */
> if (vma_is_anonymous(vma))
> return;
>
> So if that's the case the unit test triggers, I'm confused.

Ah, got it. It's not that we have to place a marker, just that it can
happen. Of course it can. All makes sense.

Thanks!