linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [Patch v2] selftests/mm: check content to see whether mremap corrupt data
@ 2025-08-31  2:27 Wei Yang
  2025-09-01  2:08 ` wang lian
  2025-09-01  7:22 ` David Hildenbrand
  0 siblings, 2 replies; 23+ messages in thread
From: Wei Yang @ 2025-08-31  2:27 UTC (permalink / raw)
  To: akpm, david, lorenzo.stoakes, ziy, baolin.wang
  Cc: linux-mm, linux-kselftest, Wei Yang

After mremap(), add a check on content to see whether mremap corrupt
data.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>

---
v2: add check on content instead of just test backed folio
---
 tools/testing/selftests/mm/split_huge_page_test.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
index 10ae65ea032f..229b6dcabece 100644
--- a/tools/testing/selftests/mm/split_huge_page_test.c
+++ b/tools/testing/selftests/mm/split_huge_page_test.c
@@ -423,10 +423,14 @@ static void split_pte_mapped_thp(void)
 
 	/* smap does not show THPs after mremap, use kpageflags instead */
 	thp_size = 0;
-	for (i = 0; i < pagesize * 4; i++)
+	for (i = 0; i < pagesize * 4; i++) {
+		if (pte_mapped[i] != (char)i)
+			ksft_exit_fail_msg("%ld byte corrupted\n", i);
+
 		if (i % pagesize == 0 &&
 		    is_backed_by_folio(&pte_mapped[i], pmd_order, pagemap_fd, kpageflags_fd))
 			thp_size++;
+	}
 
 	if (thp_size != 4)
 		ksft_exit_fail_msg("Some THPs are missing during mremap\n");
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2025-09-02 15:43 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-31  2:27 [Patch v2] selftests/mm: check content to see whether mremap corrupt data Wei Yang
2025-09-01  2:08 ` wang lian
2025-09-01  7:22 ` David Hildenbrand
2025-09-01  8:11   ` wang lian
2025-09-01  8:16     ` David Hildenbrand
2025-09-01  8:34       ` wang lian
2025-09-01  8:43   ` Wei Yang
2025-09-01 12:56   ` Zi Yan
2025-09-01 13:03     ` David Hildenbrand
2025-09-01 17:04       ` Zi Yan
2025-09-01 19:10         ` David Hildenbrand
2025-09-02  2:51           ` Wei Yang
2025-09-02  7:49             ` David Hildenbrand
2025-09-02  8:13               ` Wei Yang
2025-09-02  8:23                 ` David Hildenbrand
2025-09-02  8:28                   ` Wei Yang
2025-09-02  8:16           ` Wei Yang
2025-09-02  8:26             ` David Hildenbrand
2025-09-02 14:56           ` Zi Yan
2025-09-02 15:28             ` David Hildenbrand
2025-09-02 15:39               ` Zi Yan
2025-09-02 15:40               ` David Hildenbrand
2025-09-02 15:42                 ` Zi Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).