linux/tools/testing/selftests/mm
Lorenzo Stoakes 742d3663a5 selftests/mm: add test for invalid multi VMA operations
We can use UFFD to easily assert invalid multi VMA moves, so do so,
asserting expected behaviour when VMAs invalid for a multi VMA operation
are encountered.

We assert both that such operations are not permitted, and that we do not
even attempt to move the first VMA under these circumstances.

We also assert that we can still move a single VMA regardless.

We then assert that a partial failure can occur if the invalid VMA appears
later in the range of multiple VMAs, both at the very next VMA, and also at
the end of the range.

As part of this change, we are using the is_range_valid() helper more
aggressively. Therefore, fix a bug where stale buffered data would hang
around on success, causing subsequent calls to is_range_valid() to
potentially give invalid results.

We simply have to fflush() the stream on success to resolve this issue.

Link: https://lkml.kernel.org/r/c4fb86dd5ba37610583ad5fc0e0c2306ddf318b9.1754218667.git.lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-08-19 16:35:55 -07:00
..
page_frag
.gitignore selftests/mm: add process_madvise() tests 2025-08-02 12:06:08 -07:00
Makefile selftests/mm: add process_madvise() tests 2025-08-02 12:06:08 -07:00
charge_reserved_hugetlb.sh selftests/mm: generate a temporary mountpoint for cgroup filesystem 2025-04-11 17:32:37 -07:00
check_config.sh
compaction_test.c selftests/mm: compaction_test: support platform with huge mount of memory 2025-05-07 23:39:39 -07:00
config selftests/mm: add configs to fix testcase failure 2025-06-19 20:48:02 -07:00
cow.c selftests/mm: reuse FORCE_READ to replace "asm volatile("" : "+r" (XXX));" 2025-07-24 19:12:41 -07:00
droppable.c
guard-regions.c selftests/mm: guard-regions: Use SKIP() instead of ksft_exit_skip() 2025-07-24 19:12:42 -07:00
gup_longterm.c selftest/mm: skip if fallocate() is unsupported in gup_longterm 2025-07-09 22:42:11 -07:00
gup_test.c
hmm-tests.c
hugepage-mmap.c
hugepage-mremap.c
hugepage-shm.c
hugepage-vmemmap.c
hugetlb-madvise.c selftests/mm: reuse FORCE_READ to replace "asm volatile("" : "+r" (XXX));" 2025-07-24 19:12:41 -07:00
hugetlb-read-hwpoison.c
hugetlb-soft-offline.c
hugetlb_dio.c
hugetlb_fault_after_madv.c
hugetlb_madv_vs_map.c
hugetlb_reparenting_test.sh selftests/mm: restore default nr_hugepages value during cleanup in hugetlb_reparenting_test.sh 2025-05-11 17:48:29 -07:00
khugepaged.c ksm_tests: skip hugepage test when Transparent Hugepages are disabled 2025-07-09 22:42:23 -07:00
ksm_functional_tests.c selftests/mm: fix UFFDIO_API usage with proper two-step feature negotiation 2025-07-09 22:42:23 -07:00
ksm_tests.c ksm_tests: skip hugepage test when Transparent Hugepages are disabled 2025-07-09 22:42:23 -07:00
madv_populate.c selftests/mm: deduplicate test names in madv_populate 2025-05-31 22:46:13 -07:00
map_fixed_noreplace.c selftests/mm: deduplicate second mmap() of 5*PAGE_SIZE at base 2025-05-22 14:55:37 -07:00
map_hugetlb.c
map_populate.c
mdwe_test.c
memfd_secret.c
merge.c tools/testing/selftests: add mremap() unfaulted/faulted test cases 2025-07-13 16:38:25 -07:00
migration.c selftests/mm: reuse FORCE_READ to replace "asm volatile("" : "+r" (XXX));" 2025-07-24 19:12:41 -07:00
mkdirty.c
mlock-random-test.c
mlock2-tests.c selftests/mm: deduplicate test logging in test_mlock_lock() 2025-05-31 22:46:08 -07:00
mlock2.h
mrelease_test.c
mremap_dontunmap.c
mremap_test.c selftests/mm: add test for invalid multi VMA operations 2025-08-19 16:35:55 -07:00
mseal_helpers.h
mseal_test.c
on-fault-limit.c
pagemap_ioctl.c selftests/mm: reuse FORCE_READ to replace "asm volatile("" : "+r" (XXX));" 2025-07-24 19:12:41 -07:00
pfnmap.c selftests/mm: two fixes for the pfnmap test 2025-05-31 22:46:14 -07:00
pkey-arm64.h
pkey-helpers.h
pkey-powerpc.h selftests/mm: fix a build failure on powerpc 2025-05-07 23:39:41 -07:00
pkey-x86.h
pkey_sighandler_tests.c
pkey_util.c selftests/mm: fix build break when compiling pkey_util.c 2025-05-07 23:39:41 -07:00
process_madv.c selftests/mm: add process_madvise() tests 2025-08-02 12:06:08 -07:00
protection_keys.c
run_vmtests.sh selftests/mm: add process_madvise() tests 2025-08-02 12:06:08 -07:00
settings selftests/mm: increase timeout from 180 to 900 seconds 2025-06-19 20:48:01 -07:00
soft-dirty.c ksm_tests: skip hugepage test when Transparent Hugepages are disabled 2025-07-09 22:42:23 -07:00
split_huge_page_test.c Summary of significant series in this pull request: 2025-07-31 14:57:54 -07:00
test_hmm.sh
test_page_frag.sh
test_vmalloc.sh
thp_settings.c ksm_tests: skip hugepage test when Transparent Hugepages are disabled 2025-07-09 22:42:23 -07:00
thp_settings.h ksm_tests: skip hugepage test when Transparent Hugepages are disabled 2025-07-09 22:42:23 -07:00
thuge-gen.c selftests/mm: use generic read_sysfs in thuge-gen test 2025-07-09 22:42:07 -07:00
transhuge-stress.c
uffd-common.c
uffd-common.h
uffd-stress.c
uffd-unit-tests.c selftests/mm: reduce uffd-unit-test poison test to minimum 2025-07-09 22:42:20 -07:00
uffd-wp-mremap.c
va_high_addr_switch.c
va_high_addr_switch.sh selftests/mm: skip hugevm test if kernel config file is not present 2025-05-31 22:46:11 -07:00
virtual_address_range.c selftests/mm: fix validate_addr() helper 2025-06-25 15:55:04 -07:00
vm_util.c selftests/mm: pagemap_scan ioctl: add PFN ZERO test cases 2025-07-19 18:59:44 -07:00
vm_util.h selftests/mm: reuse FORCE_READ to replace "asm volatile("" : "+r" (XXX));" 2025-07-24 19:12:41 -07:00
write_hugetlb_memory.sh
write_to_hugetlbfs.c