UPSTREAM: selftests/mm: rename guard-pages to guard-regions

The feature formerly referred to as guard pages is more correctly referred
to as 'guard regions', as in fact no pages are ever allocated in the
process of installing the regions.

To avoid confusion, rename the tests accordingly.

[lorenzo.stoakes@oracle.com: fix guard regions invocation]
  Link: https://lkml.kernel.org/r/13426c71-d069-4407-9340-b227ff8b8736@lucifer.local
Link: https://lkml.kernel.org/r/1c3cd04a3f69b5756b94bda701ac88325a9be18b.1739469950.git.lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Kalesh Singh <kaleshsingh@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: "Paul E . McKenney" <paulmck@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit ce1c0824fc2a2e81b384483e4ab66e06f8fc0f3c)

Bug: 402449065
Change-Id: I95e11f5bce2ab1e6c60a367893e8dafc9c28bdd6
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
Lorenzo Stoakes
2025-02-13 18:17:01 +00:00
committed by Carlos Llamas
parent 8261d30079
commit 458e4dbd0b
3 changed files with 23 additions and 23 deletions

View File

@@ -86,7 +86,7 @@ TEST_GEN_FILES += hugetlb_fault_after_madv
TEST_GEN_FILES += hugetlb_madv_vs_map
TEST_GEN_FILES += hugetlb_dio
TEST_GEN_FILES += droppable
TEST_GEN_FILES += guard-pages
TEST_GEN_FILES += guard-regions
ifneq ($(ARCH),arm64)
TEST_GEN_FILES += soft-dirty

View File

@@ -104,12 +104,12 @@ static bool try_read_write_buf(char *ptr)
return try_read_buf(ptr) && try_write_buf(ptr);
}
FIXTURE(guard_pages)
FIXTURE(guard_regions)
{
unsigned long page_size;
};
FIXTURE_SETUP(guard_pages)
FIXTURE_SETUP(guard_regions)
{
struct sigaction act = {
.sa_handler = &handle_fatal,
@@ -123,7 +123,7 @@ FIXTURE_SETUP(guard_pages)
self->page_size = (unsigned long)sysconf(_SC_PAGESIZE);
};
FIXTURE_TEARDOWN(guard_pages)
FIXTURE_TEARDOWN(guard_regions)
{
struct sigaction act = {
.sa_handler = SIG_DFL,
@@ -134,7 +134,7 @@ FIXTURE_TEARDOWN(guard_pages)
sigaction(SIGSEGV, &act, NULL);
}
TEST_F(guard_pages, basic)
TEST_F(guard_regions, basic)
{
const unsigned long NUM_PAGES = 10;
const unsigned long page_size = self->page_size;
@@ -228,7 +228,7 @@ TEST_F(guard_pages, basic)
}
/* Assert that operations applied across multiple VMAs work as expected. */
TEST_F(guard_pages, multi_vma)
TEST_F(guard_regions, multi_vma)
{
const unsigned long page_size = self->page_size;
char *ptr_region, *ptr, *ptr1, *ptr2, *ptr3;
@@ -364,7 +364,7 @@ TEST_F(guard_pages, multi_vma)
* Assert that batched operations performed using process_madvise() work as
* expected.
*/
TEST_F(guard_pages, process_madvise)
TEST_F(guard_regions, process_madvise)
{
const unsigned long page_size = self->page_size;
char *ptr_region, *ptr1, *ptr2, *ptr3;
@@ -459,7 +459,7 @@ TEST_F(guard_pages, process_madvise)
}
/* Assert that unmapping ranges does not leave guard markers behind. */
TEST_F(guard_pages, munmap)
TEST_F(guard_regions, munmap)
{
const unsigned long page_size = self->page_size;
char *ptr, *ptr_new1, *ptr_new2;
@@ -497,7 +497,7 @@ TEST_F(guard_pages, munmap)
}
/* Assert that mprotect() operations have no bearing on guard markers. */
TEST_F(guard_pages, mprotect)
TEST_F(guard_regions, mprotect)
{
const unsigned long page_size = self->page_size;
char *ptr;
@@ -545,7 +545,7 @@ TEST_F(guard_pages, mprotect)
}
/* Split and merge VMAs and make sure guard pages still behave. */
TEST_F(guard_pages, split_merge)
TEST_F(guard_regions, split_merge)
{
const unsigned long page_size = self->page_size;
char *ptr, *ptr_new;
@@ -676,7 +676,7 @@ TEST_F(guard_pages, split_merge)
}
/* Assert that MADV_DONTNEED does not remove guard markers. */
TEST_F(guard_pages, dontneed)
TEST_F(guard_regions, dontneed)
{
const unsigned long page_size = self->page_size;
char *ptr;
@@ -729,7 +729,7 @@ TEST_F(guard_pages, dontneed)
}
/* Assert that mlock()'ed pages work correctly with guard markers. */
TEST_F(guard_pages, mlock)
TEST_F(guard_regions, mlock)
{
const unsigned long page_size = self->page_size;
char *ptr;
@@ -802,7 +802,7 @@ TEST_F(guard_pages, mlock)
*
* - Moving a mapping alone should retain markers as they are.
*/
TEST_F(guard_pages, mremap_move)
TEST_F(guard_regions, mremap_move)
{
const unsigned long page_size = self->page_size;
char *ptr, *ptr_new;
@@ -849,7 +849,7 @@ TEST_F(guard_pages, mremap_move)
* will have to remove guard pages manually to fix up (they'd have to do the
* same if it were a PROT_NONE mapping).
*/
TEST_F(guard_pages, mremap_expand)
TEST_F(guard_regions, mremap_expand)
{
const unsigned long page_size = self->page_size;
char *ptr, *ptr_new;
@@ -912,7 +912,7 @@ TEST_F(guard_pages, mremap_expand)
* if the user were using a PROT_NONE mapping they'd have to manually fix this
* up also so this is OK.
*/
TEST_F(guard_pages, mremap_shrink)
TEST_F(guard_regions, mremap_shrink)
{
const unsigned long page_size = self->page_size;
char *ptr;
@@ -976,7 +976,7 @@ TEST_F(guard_pages, mremap_shrink)
* Assert that forking a process with VMAs that do not have VM_WIPEONFORK set
* retain guard pages.
*/
TEST_F(guard_pages, fork)
TEST_F(guard_regions, fork)
{
const unsigned long page_size = self->page_size;
char *ptr;
@@ -1031,7 +1031,7 @@ TEST_F(guard_pages, fork)
* Assert expected behaviour after we fork populated ranges of anonymous memory
* and then guard and unguard the range.
*/
TEST_F(guard_pages, fork_cow)
TEST_F(guard_regions, fork_cow)
{
const unsigned long page_size = self->page_size;
char *ptr;
@@ -1102,7 +1102,7 @@ TEST_F(guard_pages, fork_cow)
* Assert that forking a process with VMAs that do have VM_WIPEONFORK set
* behave as expected.
*/
TEST_F(guard_pages, fork_wipeonfork)
TEST_F(guard_regions, fork_wipeonfork)
{
const unsigned long page_size = self->page_size;
char *ptr;
@@ -1152,7 +1152,7 @@ TEST_F(guard_pages, fork_wipeonfork)
}
/* Ensure that MADV_FREE retains guard entries as expected. */
TEST_F(guard_pages, lazyfree)
TEST_F(guard_regions, lazyfree)
{
const unsigned long page_size = self->page_size;
char *ptr;
@@ -1188,7 +1188,7 @@ TEST_F(guard_pages, lazyfree)
}
/* Ensure that MADV_POPULATE_READ, MADV_POPULATE_WRITE behave as expected. */
TEST_F(guard_pages, populate)
TEST_F(guard_regions, populate)
{
const unsigned long page_size = self->page_size;
char *ptr;
@@ -1214,7 +1214,7 @@ TEST_F(guard_pages, populate)
}
/* Ensure that MADV_COLD, MADV_PAGEOUT do not remove guard markers. */
TEST_F(guard_pages, cold_pageout)
TEST_F(guard_regions, cold_pageout)
{
const unsigned long page_size = self->page_size;
char *ptr;
@@ -1260,7 +1260,7 @@ TEST_F(guard_pages, cold_pageout)
}
/* Ensure that guard pages do not break userfaultd. */
TEST_F(guard_pages, uffd)
TEST_F(guard_regions, uffd)
{
const unsigned long page_size = self->page_size;
int uffd;

View File

@@ -376,7 +376,7 @@ CATEGORY="mremap" run_test ./mremap_dontunmap
CATEGORY="hmm" run_test bash ./test_hmm.sh smoke
# MADV_GUARD_INSTALL and MADV_GUARD_REMOVE tests
CATEGORY="madv_guard" run_test ./guard-pages
CATEGORY="madv_guard" run_test ./guard-regions
# MADV_POPULATE_READ and MADV_POPULATE_WRITE tests
CATEGORY="madv_populate" run_test ./madv_populate