]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/mm: add test for invalid multi VMA operations
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Sun, 3 Aug 2025 11:11:23 +0000 (12:11 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 19 Aug 2025 23:35:55 +0000 (16:35 -0700)
commit742d3663a5775cb7b957f4ca2ddb4ccd26badb94
tree56e96bcd3571439a35bf8bf4ca7ddfc0fd8f9518
parentd5f416c7c36456676c2cf5ab98776db2e7601f27
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>
tools/testing/selftests/mm/mremap_test.c