В ядре Linux устранена следующая уязвимость:
iio: буфер: исправлена утечка ограждения DMA в iio_buffer_enqueue_dmabuf().
iio_buffer_enqueue_dmabuf() выделяет структуру iio_dma_fence (104 байта,
kmalloc-128) через kmalloc_obj()+dma_fence_init(), который устанавливает начальный
kref в 1. Затем он вызывает dma_resv_add_fence(), что занимает секунду.
ссылка (kref=2) и сохраняет необработанный указатель в блоке->fence. На пути успеха функция возвращается без вызова dma_fence_put().
освободить исходную ссылку, чтобы каждый буфер постоянно ставился в очередь
утечка одного выделения kmalloc-128.
Рабочий элемент iio_buffer_cleanup() освобождает только временную ссылку.
берется во время сигнализации завершения с помощью iio_buffer_signal_dmabuf_done();
первоначальная ссылка из dma_fence_init() никогда не освобождается. С четырьмя экземплярами iio_rwdev с частотой 240 кГц и 512 выборками на буфер
это производит ~ 1875 выделений kmalloc-128 в секунду, что соответствует
точно наблюдал рост плиты. Тест с ftrace подтвердил, что
Событие dma_fence_destroy ни разу не сработало.
Исправьте, вызвав dma_fence_put() после dma_resv_add_fence(), передав
право собственности на ограждение объекта резервирования прямого доступа к памяти. Затем забор прямого доступа к памяти
корректно отбрасывается после получения сигнала.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: iio: buffer: Fix DMA fence leak in iio_buffer_enqueue_dmabuf() iio_buffer_enqueue_dmabuf() allocates a struct iio_dma_fence (104 bytes, kmalloc-128) via kmalloc_obj()+dma_fence_init(), which sets the initial kref to 1. It then calls dma_resv_add_fence() which takes a second reference (kref=2), and stores a raw pointer in block->fence. On the success path the function returns without calling dma_fence_put() to release the initial reference, so every buffer enqueue permanently leaks one kmalloc-128 allocation. The iio_buffer_cleanup() work item only releases the temporary reference taken during completion signalling by iio_buffer_signal_dmabuf_done(); the initial reference from dma_fence_init() is never released. With four iio_rwdev instances at 240kHz and 512 samples per buffer, this produces ~1875 kmalloc-128 allocations per second matching the observed slab growth exactly. A test with ftrace confirmed that the dma_fence_destroy event was never triggered. Fix by calling dma_fence_put() after dma_resv_add_fence(), transferring ownership of the fence to the DMA reservation object. The DMA fence then gets properly discarded after being signalled.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 8
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.11
|
6.12.93
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.18.35
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
7.0.12
|
|
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:*:*:*:*:*:*
|
— | — |