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: <24580f79-c104-41aa-bbdb-e1ce120c28a0@linux.alibaba.com>
Date: Wed, 11 Jun 2025 15:41:35 +0800
From: Baolin Wang <baolin.wang@...ux.alibaba.com>
To: Kemeng Shi <shikemeng@...weicloud.com>, hughd@...gle.com,
 willy@...radead.org, akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
 linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 2/7] mm: shmem: avoid setting error on splited entries in
 shmem_set_folio_swapin_error()



On 2025/6/9 09:19, Kemeng Shi wrote:
> 
> 
> on 6/7/2025 2:20 PM, Baolin Wang wrote:
>>
>>
>> On 2025/6/6 06:10, Kemeng Shi wrote:
>>> When large entry is splited, the first entry splited from large entry
>>> retains the same entry value and index as original large entry but it's
>>> order is reduced. In shmem_set_folio_swapin_error(), if large entry is
>>> splited before xa_cmpxchg_irq(), we may replace the first splited entry
>>> with error entry while using the size of original large entry for release
>>> operations. This could lead to a WARN_ON(i_blocks) due to incorrect
>>> nr_pages used by shmem_recalc_inode() and could lead to used after free
>>> due to incorrect nr_pages used by swap_free_nr().
>>
>> I wonder if you have actually triggered this issue? When a large swap entry is split, it means the folio is already at order 0, so why would the size of the original large entry be used for release operations? Or is there another race condition?
> All issues are found during review the code of shmem as I menthioned in
> cover letter.
> The folio could be allocated from shmem_swap_alloc_folio() and the folio
> order will keep unchange when swap entry is split.

Sorry, I did not get your point. If a large swap entry is split, we must 
ensure that the corresponding folio is order 0.

However, I missed one potential case which was recently fixed by Kairui[1].

[1] https://lore.kernel.org/all/20250610181645.45922-1-ryncsn@gmail.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ