Re: [PATCH] selftests/mm: fix uffd move-pmd test crash on 64K base page systems
From: Zenghui Yu
Date: Thu Oct 29 2026 - 09:13:39 EST
Hi Sarthak,
On 10/12/26 2:13 PM, Sarthak Sharma wrote:
> Hi Zenghui!
>
> On 10/11/26 10:05 PM, Zenghui Yu wrote:
> > From: "Zenghui Yu (Huawei)" <zenghui.yu@xxxxxxxxx>
> >
> > uffd_move_pmd_test()/uffd_move_test_common() splits the test area into
> > chunks of chunk_size and moves them one by one. On arm64 with 64K base
> > pages the chunk_size (read_pmd_pagesize()) is 512MB, which is larger than
> > the whole 32MB (UFFD_TEST_MEM_SIZE) test area:
> >
> > step_count = nr_pages / (chunk_size / page_size) == 0
> >
> > Because chunk_size > page_size, the test then aligns both areas up to
> > 512MB, which points far outside of the 32MB mappings, and decrements
> > step_count, which underflows to ULONG_MAX. The verification loop then
> > runs away and the first dereference of area_src faults with a SIGSEGV.
> >
> > Skip the test when a single chunk cannot fit into the test area.
> >
> > Fixes: a2bf6a9ca805 ("selftests/mm: add UFFDIO_MOVE ioctl test")
> > Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@xxxxxxxxx>
> > ---
>
> I run the test on a 64k kernel. Before the patch, a segmentation fault
> occurred, which was fixed by the patch. So:
>
> Tested-by: Sarthak Sharma <sarthak.sharma@xxxxxxx>
Thanks a lot!
> Though Sashiko has a few nits [1] you might take a look at.
>
> [1]
> https://sashiko.dev/#/patchset/20261011163527.95988-1-zenghui.yu%40linux.dev
I think both of these comments are valid and worth fixing, but I don't have
much bandwidth to work on them in the next few days. If you are interested,
please feel free to fix them up and post the follow-up. I'm happy to review
and test it.
Thanks again,
Zenghui