selftests: mm: add a test for moving from an offset from start of mapping
authorJoel Fernandes <joel@joelfernandes.org>
Sun, 3 Sep 2023 15:13:28 +0000 (15:13 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 4 Oct 2023 17:32:20 +0000 (10:32 -0700)
commit7b709f38dc0faf0d6dfeff681e37e59f9aabebd6
treee8456feb347bd05da24b365487ca145ec8a4f210
parent85a22845b094ec6eeb7c24c692f2290e56d9f07c
selftests: mm: add a test for moving from an offset from start of mapping

It is possible that the aligned address falls on no existing mapping,
however that does not mean that we can just align it down to that.  This
test verifies that the "vma->vm_start != addr_to_align" check in
can_align_down() prevents disastrous results if aligning down when source
and dest are mutually aligned within a PMD but the source/dest addresses
requested are not at the beginning of the respective mapping containing
these addresses.

Link: https://lkml.kernel.org/r/20230903151328.2981432-8-joel@joelfernandes.org
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Kalesh Singh <kaleshsingh@google.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Lokesh Gidra <lokeshgidra@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Paul E. McKenney <paulmck@kernel.org>
Cc: Shuah Khan <shuah@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