From a5343b255ee7d0fc55359f666b986eb45855be0e Mon Sep 17 00:00:00 2001 From: Jonathan Goyvaerts Date: Sun, 22 Nov 2026 18:27:05 -0300 Subject: [PATCH] selftests/arm64: check that a uffd-wp window's populated neighbours read zero marker_window() checks that one write into a window write-protected before its first touch maps the whole native page at once, and that the neighbours keep their uffd-wp bit. It never read the neighbours, so a populate path that left stale data in their slots would pass. Check that pages 2 and 3 read zero after the first write. The loop after it still expects their WP bit, so it also shows that a read does not clear it. Signed-off-by: Jonathan Goyvaerts --- tools/testing/selftests/arm64/user4k/uffd-wp-init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/arm64/user4k/uffd-wp-init.c b/tools/testing/selftests/arm64/user4k/uffd-wp-init.c index 78f43f1c0b9b7..2246f8425cff9 100644 --- a/tools/testing/selftests/arm64/user4k/uffd-wp-init.c +++ b/tools/testing/selftests/arm64/user4k/uffd-wp-init.c @@ -466,6 +466,8 @@ static void marker_window(size_t ps, size_t native) CHECK(physical(a + i, ps) == start + i); CHECK(((pagemap(a + i, ps) >> 57) & 1) == (i != ps)); } + /* The neighbours the write populated read zero; a read keeps their WP bit. */ + CHECK(!a[2 * ps] && !a[3 * ps]); /* An async WP fault on a populated neighbour only clears its own bit. */ a[0] = 0xa5; for (size_t i = 0; i < native; i += ps) {