lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <706bbb76-1204-4377-aeb8-0c1b21792014@linux.dev>
Date: Wed, 17 Sep 2025 21:19:18 +0800
From: Lance Yang <lance.yang@...ux.dev>
To: David Hildenbrand <david@...hat.com>
Cc: shuah@...nel.org, ioworker0@...il.com, linux-kernel@...r.kernel.org,
 linux-mm@...ck.org, linux-kselftest@...r.kernel.org,
 akpm@...ux-foundation.org, lorenzo.stoakes@...cle.com
Subject: Re: [PATCH v2 1/1] selftests/mm: skip soft-dirty tests when
 CONFIG_MEM_SOFT_DIRTY is disabled



On 2025/9/17 21:08, David Hildenbrand wrote:
> On 17.09.25 14:27, Lance Yang wrote:
>> From: Lance Yang <lance.yang@...ux.dev>
>>
>> The madv_populate and soft-dirty kselftests currently fail on systems 
>> where
>> CONFIG_MEM_SOFT_DIRTY is disabled.
>>
>> Introduce a new helper softdirty_supported() into vm_util.c/h to ensure
>> tests are properly skipped when the feature is not enabled.
>>

Oops, I missed "Suggested-by:" here ... will add in v3.

>> Signed-off-by: Lance Yang <lance.yang@...ux.dev>
>> ---
> 
> [...]
> 
>> diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/ 
>> selftests/mm/vm_util.c
>> index 56e9bd541edd..ac41d10454a5 100644
>> --- a/tools/testing/selftests/mm/vm_util.c
>> +++ b/tools/testing/selftests/mm/vm_util.c
>> @@ -449,6 +449,25 @@ bool check_vmflag_pfnmap(void *addr)
>>       return check_vmflag(addr, "pf");
>>   }
>> +bool softdirty_supported(void)
>> +{
>> +    char *addr;
>> +    bool supported = false;
>> +    const size_t pagesize = getpagesize();
>> +
>> +    /* New mappings are expected to be marked with VM_SOFTDIRTY (sd). */
>> +    addr = mmap(0, pagesize, PROT_READ | PROT_WRITE,
>> +            MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
>> +    if (!addr)
>> +        ksft_exit_fail_msg("mmap failed\n");
>> +
>> +    if (check_vmflag(addr, "sd"))
>> +        supported = true;
> 
> Reading the code again, this could just be
> 
> supported = check_vmflag(addr, "sd");

Nice. Will do ;)

> 
> 
> LGTM
> 
> Acked-by: David Hildenbrand <david@...hat.com>

Thanks,
Lance


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ