tools/testing/selftests: add mremap() unfaulted/faulted test cases

Assert that mremap() behaviour is as expected when moving around unfaulted
VMAs immediately adjacent to faulted ones, as well as moving around
faulted VMAs and placing them back immediately adjacent to the VMA from
which they were moved.

This also introduces a shared helper for the syscall version of mremap()
so we don't encounter any issues with libc filtering parameters.

Link: https://lkml.kernel.org/r/20250702084717.21360-1-lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Jann Horn <jannh@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Lorenzo Stoakes
2025-07-02 09:47:17 +01:00
committed by Andrew Morton
parent 526f36f3f4
commit 4e25f85b9f
3 changed files with 608 additions and 2 deletions

View File

@@ -117,6 +117,9 @@ static inline void log_test_result(int result)
ksft_test_result_report(result, "%s\n", test_name);
}
void *sys_mremap(void *old_address, unsigned long old_size,
unsigned long new_size, int flags, void *new_address);
/*
* On ppc64 this will only work with radix 2M hugepage size
*/