В ядре Linux устранена следующая уязвимость:
nilfs2: отклонить недопустимый индекс блока в GC ioctl
Syzbot сообщил о повреждении списка, вызванном двойным вызовом list_add_tail()
bh->b_assoc_buffers в nilfs_lookup_dirty_data_buffers(). Анализ показал, что основной причиной была вставка страницы/фолио.
с индексом страницы ULONG_MAX в кэш страниц через GC ioctl.
filemap_get_folios_tag(), вызываемый nilfs_lookup_dirty_data_buffers(),
неоднократно обнаруживает грязный фолио с индексом страницы ULONG_MAX из-за
перенос индекса, что приводит к дублированию обработки «грязных» буферов. В качестве подготовительного шага GC ioctl загружает страницу/фолио блока в
перемещаться во время сборки мусора и вставлять его в кэш страниц на основе информации
в структуре nilfs_vdesc, передаваемой в качестве аргумента.
Обычно это делает
не вызывает проблем, поскольку библиотека GC в пользовательском пространстве настраивает
структура nilfs_vdesc правильная. Однако, поскольку проверка диапазона не включена
параметры, определяющие индекс страницы, запрос с искусственно
созданные параметры, например, сгенерированные Syzbot, могут привести к
страница/фолио вставляется с индексом страницы ULONG_MAX, что запускает
выше проблема. Это решает проблему, проверяя диапазоны vd_offset и
'vd_vblocknr' в структуре nilfs_vdesc, определяющей индекс страницы,
тем самым предотвращая вставку недопустимых страниц/фолио.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: nilfs2: reject invalid block index in GC ioctl Syzbot reported list corruption caused by a double list_add_tail() call on bh->b_assoc_buffers within nilfs_lookup_dirty_data_buffers(). Analysis revealed that the root cause was the insertion of a page/folio with a page index of ULONG_MAX into the page cache via the GC ioctl. filemap_get_folios_tag(), called by nilfs_lookup_dirty_data_buffers(), repeatedly detects a dirty folio with a page index of ULONG_MAX due to index wrap-around, leading to duplicate processing of dirty buffers. As a preparatory step, the GC ioctl loads the page/folio of the block to be moved during GC and inserts it into the page cache based on information in the nilfs_vdesc structure passed as an argument. Normally, this does not cause issues because the user-space GC library configures the nilfs_vdesc structure properly. However, since there is no range check on the parameters determining the page index, a request with artificially crafted parameters -- such as those generated by Syzbot -- can result in a page/folio being inserted with a page index of ULONG_MAX, triggering the above problem. This resolves the issue by checking the ranges of 'vd_offset' and 'vd_vblocknr' in the nilfs_vdesc structure that determine the page index, thereby preventing the invalid page/folio insertions.