From: Nikolai Dokutovich <ndokutovich@gmail.com>
To: David Hildenbrand <david@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Shuah Khan <shuah@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>, Michal Hocko <mhocko@suse.com>,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
Nikolai Dokutovich <ndokutovich@gmail.com>
Subject: [PATCH 3/3] selftests/mm: skip the ksm PROT_NONE test without FOLL_FORCE
Date: Sun, 29 Nov 2026 07:00:41 +0300 [thread overview]
Message-ID: <20261129040041.37139-4-ndokutovich@gmail.com> (raw)
In-Reply-To: <20261129040041.37139-1-ndokutovich@gmail.com>
test_prot_none() stores a unique value in every page of a PROT_NONE mapping
through /proc/self/mem, which is a forced write. With the default
CONFIG_PROC_MEM_FORCE_PTRACE the kernel denies it, so the test reports
not ok 5 ptrace write failed
instead of skipping. Probe the permission for a PROT_NONE mapping at the
start of the test and skip when it is denied.
Commit a3907a3169d0 ("selftests/mm: specify requirement for
PROC_MEM_ALWAYS_FORCE=y") asks for CONFIG_PROC_MEM_ALWAYS_FORCE=y in
mm/config, which applies once that fragment is merged into the kernel
configuration; this skip additionally keeps an installed binary from
failing on a kernel that was not built that way.
Signed-off-by: Nikolai Dokutovich <ndokutovich@gmail.com>
---
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..5d9dd533a575 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_probe(PROT_NONE) == PROC_MEM_FORCE_WRITE_DENIED) {
+ ksft_test_result_skip("FOLL_FORCE write into a PROT_NONE mapping returned EIO\n");
+ return;
+ }
+
map = mmap_and_merge_range(0x11, size, PROT_NONE, KSM_MERGE_MADVISE);
if (map == MAP_FAILED)
goto unmap;
--
2.43.0
next prev parent reply other threads:[~2026-11-29 4:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 4:00 [PATCH 0/3] selftests/mm: skip tests when FOLL_FORCE writes are denied Nikolai Dokutovich
2026-11-29 4:00 ` [PATCH 1/3] selftests/mm: add a probe for FOLL_FORCE writes through /proc/self/mem Nikolai Dokutovich
2026-11-29 4:00 ` [PATCH 2/3] selftests/mm: skip the mkdirty ptrace write tests without FOLL_FORCE Nikolai Dokutovich
2026-11-29 4:00 ` Nikolai Dokutovich [this message]
2026-11-29 4:04 ` [PATCH 0/3] selftests/mm: skip tests when FOLL_FORCE writes are denied Nikolai Dokutovich
-- strict thread matches above, loose matches on Subject: below --
2026-11-29 4:00 Nikolai Dokutovich
2026-11-29 4:00 ` [PATCH 3/3] selftests/mm: skip the ksm PROT_NONE test without FOLL_FORCE Nikolai Dokutovich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261129040041.37139-4-ndokutovich@gmail.com \
--to=ndokutovich@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®