В ядре Linux была устранена следующая уязвимость: mm/cma: не выпускайте CMA страницы, которые все еще используются When, драйвер вызывает dma_free_contiguous(), прежде чем quiescing DMA, страница может все еще иметь ссылку с устройства. put_page_testzero() возвращает false, WARN сжигает, но код переходит к free_contig_frozen_range() расчистка бита. Последующее распределение может передать тот же PFN новому владельцу, пока первоначальный владелец все еще ссылается на него. Параллельный put_page(), который бросает последнюю ссылку между циклом testzero и free_contig_frozen_range(), может дважды ставить страницу в очередь через page->lru, развращая списки друзей.
Избегайте коррупции, не освобождая область CMA, если какая-либо из страниц внутри все еще используется. Сделайте это явным в предупреждении, что водитель допустил утечку. При этом используйте page_ref_freeze(), чтобы сделать семантику более понятной, и переключитесь на pr_warn_ratelimited(). [david: использовать page_ref_freeze() + pr_warn_ratelimited() ]
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: mm/cma: don't release CMA pages still in use When a driver calls dma_free_contiguous() before quiescing DMA, the page might still have a reference from the device. put_page_testzero() there returns false, WARN fires, but the code proceeds to free_contig_frozen_range() putting a live page onto buddy and clearing the bitmap. A subsequent allocation can hand the same PFN to a new owner while the original holder still references it. A concurrent put_page() that drops the last reference between the testzero loop and free_contig_frozen_range() can double-queue the page via page->lru, corrupting buddy lists. Avoid the corruption by not freeing a CMA region if any of the pages inside are still in use. Make it explicit in the warning that the driver allowed a leak. While at it, use page_ref_freeze() to make the semantics clearer and switch to pr_warn_ratelimited(). [ david: use page_ref_freeze() + pr_warn_ratelimited() ]
Характеристики атаки
Последствия
Строка CVSS v3.1