On 10 Mar 2026, at 5:49, Sayali Patil wrote:

> The uffd-wp-mremap test requires the UFFD_FEATURE_PAGEFAULT_FLAG_WP
> capability. On systems where userfaultfd write-protect is
> not supported, uffd_register() fails and the test reports failures.
>
> Check for the required feature at startup and skip the test when the
> UFFD_FEATURE_PAGEFAULT_FLAG_WP capability is not present,
> preventing false failures on unsupported configurations.
>
> Before patch:
>  running ./uffd-wp-mremap
>  ------------------------
>   [INFO] detected THP size: 256 KiB
>   [INFO] detected THP size: 512 KiB
>   [INFO] detected THP size: 1024 KiB
>   [INFO] detected THP size: 2048 KiB
>   [INFO] detected hugetlb page size: 2048 KiB
>   [INFO] detected hugetlb page size: 1048576 KiB
>  1..24
>   [RUN] test_one_folio(size=65536, private=false, swapout=false,
>   hugetlb=false)
>  not ok 1 uffd_register() failed
>   [RUN] test_one_folio(size=65536, private=true, swapout=false,
>   hugetlb=false)
>  not ok 2 uffd_register() failed
>   [RUN] test_one_folio(size=65536, private=false, swapout=true,
>   hugetlb=false)
>  not ok 3 uffd_register() failed
>   [RUN] test_one_folio(size=65536, private=true, swapout=true,
>   hugetlb=false)
>  not ok 4 uffd_register() failed
>   [RUN] test_one_folio(size=262144, private=false, swapout=false,
>   hugetlb=false)
>  not ok 5 uffd_register() failed
>   [RUN] test_one_folio(size=524288, private=false, swapout=false,
>   hugetlb=false)
>  not ok 6 uffd_register() failed
>  .
>  .
>  .
>  Bail out! 24 out of 24 tests failed
>   Totals: pass:0 fail:24 xfail:0 xpass:0 skip:0 error:0
>  [FAIL]
> not ok 1 uffd-wp-mremap # exit=1
>
> After patch:
>  running ./uffd-wp-mremap
>  ------------------------
>  1..0 # SKIP uffd-wp feature not supported
>  [SKIP]
> ok 1 uffd-wp-mremap # SKIP
>
> Signed-off-by: Sayali Patil <[email protected]>
> ---
>  tools/testing/selftests/mm/uffd-wp-mremap.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
LGTM.

Acked-by: Zi Yan <[email protected]>

Best Regards,
Yan, Zi

Reply via email to