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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ed372449-de6d-4588-868c-1b87d5655632@arm.com>
Date: Fri, 23 Jan 2026 09:17:09 +0100
From: Kevin Brodsky <kevin.brodsky@....com>
To: "David Hildenbrand (Red Hat)" <david@...nel.org>, linux-mm@...ck.org,
 linux-kselftest@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>,
 Dev Jain <dev.jain@....com>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
 Mark Brown <broonie@...nel.org>, Ryan Roberts <ryan.roberts@....com>,
 Shuah Khan <shuah@...nel.org>
Subject: Re: [PATCH v3 5/9] selftests/mm: check that FORCE_READ() succeeded

On 22/01/2026 23:18, David Hildenbrand (Red Hat) wrote:
> On 1/22/26 18:02, Kevin Brodsky wrote:
>> Many cow tests rely on FORCE_READ() to populate pages. Introduce a
>> helper to make sure that the pages are actually populated, and fail
>> otherwise.
>>
>> Suggested-by: David Hildenbrand (Red Hat) <david@...nel.org>
>> Signed-off-by: Kevin Brodsky <kevin.brodsky@....com>
>> ---
>>   tools/testing/selftests/mm/cow.c | 43 ++++++++++++++++++++++++--------
>>   1 file changed, 33 insertions(+), 10 deletions(-)
>>
>> diff --git a/tools/testing/selftests/mm/cow.c
>> b/tools/testing/selftests/mm/cow.c
>> index 83b3563be26b..d9c69c04b67d 100644
>> --- a/tools/testing/selftests/mm/cow.c
>> +++ b/tools/testing/selftests/mm/cow.c
>> @@ -75,6 +75,18 @@ static bool range_is_swapped(void *addr, size_t size)
>>       return true;
>>   }
>>   +static bool populate_page_checked(char *addr)
>> +{
>> +    bool ret;
>> +
>> +    FORCE_READ(*addr);
>> +    ret = pagemap_is_populated(pagemap_fd, addr);
>> +    if (!ret)
>> +        ksft_print_msg("Failed to populate page\n");
>> +
>> +    return ret;
>> +}
>
> LGTM.
>
> On second thought, this primarily catches if someone breaks
> FORCE_READ() ... which hopefully doesn't happen that often? ;)
>
> Because if the read succeeded, surely there must be something in the
> page tables. 

Indeed, one would hope so! The check doesn't hurt either though
(especially since we already have the pagemap fd around).

- Kevin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ