Re: [PATCH v3 2/3] selftests/mm: skip the mkdirty ptrace write tests without FOLL_FORCE

From: David Hildenbrand (Arm)

Date: Tue Dec 01 2026 - 11:24:15 EST


On 11/30/26 18:39, Nikolai Dokutovich wrote:
> mkdirty writes through /proc/self/mem into read-only PTEs and expects the
> kernel to force the write. Under the default CONFIG_PROC_MEM_FORCE_PTRACE
> policy that is only allowed when the writing task is tracing the target
> task, which is not the case here, so the setup write fails and the test
> reports a failure instead of skipping:
>
> not ok 1 write() failed
>
> Check the permission at the entry of the two ptrace write tests and skip
> them when it is denied. A kernel built with
> CONFIG_PROC_MEM_ALWAYS_FORCE or booted with proc_mem.force_override=always
> still runs them for real, so a genuine failure is still reported.
>
> 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.
>
> The remaining subtests do not depend on the forced write and keep running.
>
> Signed-off-by: Nikolai Dokutovich <ndokutovich@xxxxxxxxx>
> ---
> tools/testing/selftests/mm/mkdirty.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/mkdirty.c b/tools/testing/selftests/mm/mkdirty.c
> index 68dd447a5454..333d450d4ff3 100644
> --- a/tools/testing/selftests/mm/mkdirty.c
> +++ b/tools/testing/selftests/mm/mkdirty.c
> @@ -91,6 +91,11 @@ static void test_ptrace_write(void)
>
> ksft_print_msg("[INFO] PTRACE write access\n");
>
> + if (!proc_mem_force_write_allowed()) {
> + ksft_test_result_skip("FOLL_FORCE write probe returned EIO\n");

"FOLL_FORCE write not available\n"

Same below.

--
Cheers,

David