Re: [PATCH v3 3/3] selftests/mm: skip the ksm PROT_NONE test without FOLL_FORCE
From: David Hildenbrand (Arm)
Date: Tue Dec 01 2026 - 11:23:49 EST
On 12/1/26 08:15, xu.xin@xxxxxxxxx wrote:
>> 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. Check the permission 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@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..ffb25b250d2f 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 probe returned EIO\n");
>> + return;
>> + }
>> +
>
> How about "FOLL_FORCE write denied (check CONFIG_PROC_MEM_ALWAYS_FORCE)" to give a clearer hint?
Yes, or something even shorter as I proposed in reply to #2. Thanks.
--
Cheers,
David