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] [thread-next>] [day] [month] [year] [list]
Message-ID: <b2a08c1f-190b-4e20-b8be-704d12b406c8@redhat.com>
Date: Tue, 17 Jun 2025 11:26:46 +0200
From: David Hildenbrand <david@...hat.com>
To: Dev Jain <dev.jain@....com>, ziy@...dia.com, willy@...radead.org,
 dhowells@...hat.com, hughd@...gle.com
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, ryan.roberts@....com,
 aneesh.kumar@...nel.org
Subject: Re: [QUESTION] xas_reload() in iter_xarray_populate_pages()

On 17.06.25 11:18, Dev Jain wrote:
> 
> On 17/06/25 1:17 pm, David Hildenbrand wrote:
>> On 17.06.25 07:10, Dev Jain wrote:
>>>
>>> On 26/05/25 12:05 pm, Dev Jain wrote:
>>>> Hello all,
>>>>
>>>> After doing an xas_load() and xas_retry(), we take neither a
>>>> reference nor a lock
>>>> on the folio, and we do an xas_reload(). Is this just to reduce the
>>>> time window
>>>> for a race?
>>>>
>>>> If the above is true, then, there is a negligible window between
>>>> xas_load() and
>>>> xas_reload(), because only xas_retry() exists between them, so why
>>>> to even reload()?
>>>>
>>>> Thanks,
>>>> Dev
>>>
>>> I do not completely remember our discussion in THP Cabal; I recall
>>> David Howells maybe
>>> saying that the folios are already locked, so it is safe to do
>>> xas_load and then do
>>> a folio_get()? Even if we remove the redundant xas_reload(), I still
>>> don't understand
>>> why we won't need xas_reload() at least after folio_get()?
>>
>> I think the points where
>>
>> (a) this should go all away soon
>>
>> (b) there is the expectation that the folios cannot get truncated
>>      concurrently. So we can do an unconditional folio_get(), don't have
>>      to check folio->mapping etc.
> 
> Well...pretty sure the file read path is taking the inode->i_rwsem or
> i_lock somewhere,
> 
> to synchronize with truncation/reclaim, can't figure out where. Reclaim
> takes the i_lock in __remove_mapping and
> 
> then freezes the folio reference, so the read path must lock i_lock
> somewhere.

I mean, if concurrent freeing of a folio would be possible, the function 
would be horribly broken :)

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ