Ad

CVE-2026-99733

NONE EPSS 0.16%
Обновлено 20 ноября 2026
Linux
Параметр Значение
Поставщик Linux
Публичный эксплойт Нет

In the Linux kernel, the following vulnerability has been resolved: mm/truncate: look again if a folio left the mapping invalidate_inode_pages2_range() skips a folio which no longer belongs to the mapping by the time it has got the folio lock, on the assumption that somebody else has removed it from the page cache. Но фолио, возможно, было заменено, а затем появился новый фолио с теми же данными по этому индексу. В большинстве случаев, как и в случае с миграцией фолио, это невозможно.

Тем не менее, collapse_file () проверяет только пересчет старых фолиантов под замком i_pages и полагается на их замки фолио оттуда. Это работает для пользователей, которые повторяют поиск, когда обнаруживают, что folio->mapping изменился. Однако возможен следующий сценарий: CPU0 pwrite(O_DIRECT) CPU1 collapse_file() kiocb_invalidate_pages() читает фолио (старые данные), блокирует его пересчет, проверяется копия записи в new_folio kiocb_invalidate_post_direct_write() find_get_entries() -> старый фолио xas_store(new_folio) folio->mapping NULL folio_unlock(folio) folio_lock() folio->mapping ! mapping -> В этом сценарии свернутый фолио с данными до записи остается в кэше страницы после того, как запись вернулась.

Раньше это было невозможно, так как khugepaged только сворачивал файлы, которые никто не мог открыть для записи. Перезапустите поиск по этому индексу, как это делает shmem_undo_range(). Та же проблема, кажется, существует и в truncate_inode_pages_range(), когда truncate_inode_folio() терпит неудачу, поэтому справьтесь с ней и там, но немного по-другому: просто проверьте еще раз через find_get_entries().

Показать оригинальное описание (EN)

In the Linux kernel, the following vulnerability has been resolved: mm/truncate: look again if a folio left the mapping invalidate_inode_pages2_range() skips a folio which no longer belongs to the mapping by the time it has got the folio lock, on the assumption that somebody else has removed it from the page cache. But the folio may have been replaced, and then there is a new folio with the same data at that index. For most cases, like folio migration, that is impossible. However, collapse_file() only checks the refcount of the old folios, under the i_pages lock, and relies on their folio locks from there on. That works for users which repeat the lookup when they find folio->mapping changed. The following scenario is, however, possible: CPU0 pwrite(O_DIRECT) CPU1 collapse_file() kiocb_invalidate_pages() read the folio (old data), lock it refcount check the write completes copy to new_folio kiocb_invalidate_post_direct_write() find_get_entries() -> old folio xas_store(new_folio) folio->mapping = NULL folio_unlock(folio) folio_lock() folio->mapping != mapping -> continue In that scenario, the collapsed folio with the data from before the write stays in the page cache after the write has returned. This used to be impossible, as khugepaged only collapsed files that nobody had open for writing. Restart the lookup at that index, like shmem_undo_range() does. The same problem seems to exist in truncate_inode_pages_range() as well when truncate_inode_folio() fails, so handle it there as well, but slightly differently: simply check once more through find_get_entries().