В ядре Linux устранена следующая уязвимость:
iomap: избегайте потенциального разыменования нулевого фолио-> во время отчета об ошибках
При сбое чтения из буфера iomap_finish_folio_read() сообщает об ошибке.
с fserror_report_io(фолио->сопоставление->хост, ...). Это называется после
ifs->read_bytes_pending был уменьшен на количество байтов, которые были предприняты
быть прочитанным. Если фолио разделено на несколько завершенных операций чтения, фолио
гарантированно останется заблокированным, пока read_bytes_pending > 0.
Однажды
iomap_finish_folio_read() уменьшает read_bytes_pending, другой
чтение в режиме реального времени может завершить и завершить чтение фолио, что разблокирует
это. Это позволяет выполнить усеченную логику и отсоединить фолио (установить
фолио->сопоставление с NULL). Путь сообщения об ошибках затем может разыменовать
NULL фолио->сопоставление.
Как сообщил Сэм Сан, это раса, которая может
происходят:
CPU0: неудачное завершение CPU1: окончательное завершение CPU2: усечение
----------------------- ---------------------- --------------
read_bytes_pending -= длина
закончено = ложь
/* вытеснено ранее
fserror_report_io() */
read_bytes_pending -= длина
закончено = правда
folio_end_read()
усечение очищает
фолио->картография
fserror_report_io(
фолио->сопоставление->хост, ...)
^ NULL разыменование
Исправьте это, сначала сообщив об ошибке, прежде чем уменьшать ее.
ifs->read_bytes_pending.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: iomap: avoid potential null folio->mapping deref during error reporting When a buffered read fails, iomap_finish_folio_read() reports the error with fserror_report_io(folio->mapping->host, ...). This is called after ifs->read_bytes_pending has been decremented by the bytes attempted to be read. For a folio split across multiple read completions, the folio is only guaranteed to stay locked while read_bytes_pending > 0. Once iomap_finish_folio_read() decrements read_bytes_pending, another in-flight read can complete and end the read on the folio, which unlocks it. This allows truncate logic to run and detach the folio (set folio->mapping to NULL). The error reporting path then can dereference a NULL folio->mapping. As reported by Sam Sun, this is the race that can occur: CPU0: failed completion CPU1: final completion CPU2: truncate ----------------------- ---------------------- -------------- read_bytes_pending -= len finished = false /* preempted before fserror_report_io() */ read_bytes_pending -= len finished = true folio_end_read() truncate clears folio->mapping fserror_report_io( folio->mapping->host, ...) ^ NULL deref Fix this by reporting the error first before decrementing ifs->read_bytes_pending.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 7
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
7.0
|
7.0.13
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc5:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc6:*:*:*:*:*:*
|
— | — |