[PATCH v2 00/12] selftests/mm: improve mremap_test

From: Sarthak Sharma

Date: Tue Oct 06 2026 - 05:29:01 EST


This series fixes correctness issues in mremap_test, simplifies its
test infrastructure and strengthens validation of remapped mappings.

Patches 1-3 remove unused command line handling, unnecessary cleanup
checks and redundant errno handling. Patch 4 converts the test to use
kselftest helpers and removes manual failure tracking.

Patches 5-8 fix handling of unavailable userfaultfd support, unexpected
mremap() successes, data-corruption failures and cleanup after mmap()
failures. Patch 9 removes perf tests and timing infrastructure.

Patches 10 and 11 replace threshold-based random-data validation with
sampled validation and a deterministic data pattern. Patch 12
strengthens multi VMA validation by also checking the mapping state
of holes after remapping.

Changes in v2:
- Add a first patch to remove command-line options
- Add a second patch to remove munmap() checks from cleanup paths
- Add a third patch to simplify errno handling
- Drop the "correct multiple VMA range size" patch
- Add an eighth patch to fix cleanup after target mmap() failures
- Replace fully populating and validating large mappings with
populating and validating 10 pages each from the start, middle
and end
- Extend multi VMA strengthening to userfaultfd multi VMA test
- Fix minor formatting issues

Previous versions:
v1: https://lore.kernel.org/all/20260924050009.19974-1-sarthak.sharma@xxxxxxx/

---
Sarthak Sharma (12):
selftests/mm: mremap_test: remove command line options
selftests/mm: mremap_test: drop munmap() checks from cleanup paths
selftests/mm: mremap_test: simplify errno handling
selftests/mm: mremap_test: use kselftest helpers
selftests/mm: mremap_test: skip test when userfaultfd is unavailable
selftests/mm: mremap_test: fail unexpected mremap successes
selftests/mm: mremap_test: fail on data corruption
selftests/mm: mremap_test: handle cleanup after mmap failures
selftests/mm: mremap_test: remove perf tests and timing
selftests/mm: mremap_test: replace validation threshold with sampled
checks
selftests/mm: mremap_test: replace random data with deterministic
pattern
selftests/mm: mremap_test: strengthen multi VMA validation

tools/testing/selftests/mm/mremap_test.c | 701 ++++++++++-------------
1 file changed, 291 insertions(+), 410 deletions(-)

--
2.53.0