Re: [PATCH] selftests/mm: fix uffd move-pmd test crash on 64K base page systems
From: Zenghui Yu
Date: Thu Oct 29 2026 - 09:49:53 EST
Hi David,
On 10/13/26 3:39 PM, David Hildenbrand (Arm) wrote:
> On 10/11/26 18:35, 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.
>
> That leaves 64k untested, though? Why not adjust the chunk size accordingly?
Right. Apparently this has never been tested on 64k :)
I agree that scaling the chunk size is the better approach -- it gives us
actual test coverage on such configuration, instead of bailing out early.
If anyone is interested in it, please feel free to send a patch. Otherwise
I'll work on it when I get some spare time.
Thanks,
Zenghui