[PATCH v5 3/3] selftests/mm: skip the ksm PROT_NONE test without FOLL_FORCE

From: Nikolai Dokutovich

Date: Tue Dec 01 2026 - 14:17:09 EST


test_prot_none() fails when the kernel does not allow forced writes:

not ok 5 ptrace write failed

Check the permission at the start of the test and skip instead.

Signed-off-by: Nikolai Dokutovich <ndokutovich@xxxxxxxxx>
---
tools/testing/selftests/mm/ksm_functional_tests.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c
index 31c06c72203f..e21037c9bf24 100644
--- a/tools/testing/selftests/mm/ksm_functional_tests.c
+++ b/tools/testing/selftests/mm/ksm_functional_tests.c
@@ -629,6 +629,11 @@ static void test_prot_none(void)

ksft_print_msg("[RUN] %s\n", __func__);

+ if (!proc_mem_force_write_allowed()) {
+ ksft_test_result_skip("FOLL_FORCE write not available\n");
+ return;
+ }
+
map = mmap_and_merge_range(0x11, size, PROT_NONE, KSM_MERGE_MADVISE);
if (map == MAP_FAILED)
goto unmap;
--
2.43.0