В ядре Linux была устранена следующая уязвимость: drm/i915: исправлен неправильный порядок разбора RCU i915_gem_busy_ioctl использует dma_resv_for_each_fence_unlocked() для итерации через заборы в объекте GEM без удержания ссылки, а только боковой замок RCU. Здесь может произойти то, что объект GEM уничтожается одновременно, в то время как i915_gem_busy_ioctl все еще работает. Это не освобождает память объектов GEM, но все же удаляет все ссылки dma_fence.
Теперь, когда dma_resv_for_each_fence_unlocked () видит уничтоженный dma_fence, он предполагает, что был установлен новый список ограждений и повторно запускается цикл. Но в случае разрушенного объекта GEM новый список заборов никогда не устанавливается, только старый освобождается, и поэтому итерация никогда не заканчивается, что приводит к бесконечному циклу. Решение состоит в том, чтобы отказаться от ссылок на забор только после льготного периода RCU.
Тег исправления не обязательно патч, вводящий проблему, но тот, который делает его настолько хуже, что нам нужно решить его. Об этом сообщает Sashiko-bot. (Вишня выбрана из commit 5113479556025093bf8133bb2dcaa33be2d50921)
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: drm/i915: fix incorrect RCU teardown order i915_gem_busy_ioctl uses dma_resv_for_each_fence_unlocked() to iterate over the fences in an GEM object without holding a reference but only the RCU read side lock. What can happen here is that the GEM object is destroyed concurrently while i915_gem_busy_ioctl is still running. This won't free the GEM objects memory, but still drops all the dma_fence references. Now when dma_resv_for_each_fence_unlocked() sees a destroyed dma_fence it assumes that a new fence list was installed and re-starts the loop. But in the case of a destroyed GEM object a new fence list is never installed, only the old one freed and therefore the iteration never finishes resulting in an endless loop. The solution is to drop the fence references only after the RCU grace period. The fixes tag is not necessary the patch introducing the problem, but the one making it so worse that we need to address it. This problem was pointed out by Sashiko-bot. (cherry picked from commit 5113479556025093bf8133bb2dcaa33be2d50921)