В ядре Linux устранена следующая уязвимость:
Ice: исправлена утечка страницы Rx в многобуферных кадрах. Функция Ice_put_rx_mbuf() обрабатывает вызов Ice_put_rx_buf() для каждого
буфер в текущем кадре. Эта функция была введена как часть
обработка поддержки мультибуферного XDP в драйвере льда.
Он работает путем перебора буферов от first_desc до 1 плюс
общее количество фрагментов в кадре, кэшированных до программы XDP
был казнен. Если оборудование отправляет дескриптор с размером 0, логика, используемая в
Ice_put_rx_mbuf() прерывается. Такие дескрипторы пропускаются и не добавляются.
как фрагменты в Ice_add_xdp_frag.
Поскольку буфер не считается
фрагмент, мы не перебираем его в Ice_put_rx_mbuf() и поэтому не
вызовите Ice_put_rx_buf(). Поскольку мы не вызываем Ice_put_rx_buf(), мы не пытаемся повторно использовать
страницу или освободите ее. Это оставляет устаревшую страницу на ринге, а мы этого не делаем.
увеличить next_to_alloc.
Ice_reuse_rx_page() предполагает, что next_to_alloc был увеличен.
правильно и что он всегда указывает на буфер с NULL-страницей.
Поскольку
эта функция не проверяет, она с радостью переработает страницу поверх
буфера next_to_alloc, теряя след старой страницы. Обратите внимание, что эта утечка происходит только для кадров с несколькими буферами. Функция Ice_put_rx_mbuf() всегда обрабатывает хотя бы один буфер, поэтому
кадр с одним буфером всегда будет обрабатываться правильно.
Это не ясно
именно поэтому оборудование иногда передает нам дескрипторы размером 0,
но это происходит довольно регулярно с «огромными кадрами», используемыми 9K MTU. Чтобы исправить Ice_put_rx_mbuf(), нам нужно обязательно вызвать Ice_put_rx_buf()
все буферы между first_desc и next_to_clean. Заимствуйте логику
аналогичная функция в i40e используется для той же цели.
Используйте ту же логику
также в Ice_get_pgcnts(). Вместо перебора только количества фрагментов используйте цикл, который
выполняет итерацию до тех пор, пока текущий индекс не достигнет элемента next_to_clean.
за текущий кадр. В отличие от i40e, функция Ice_put_rx_mbuf() делает
вызовите Ice_put_rx_buf() в последнем буфере кадра, указывая на конец
пакет.
Для нелинейных (многобуферных) кадров нам необходимо соблюдать осторожность при настройке
страницаcnt_bias. Программа XDP может освободить фрагменты из хвоста
кадр, и в этом случае эта страница фрагмента уже освобождена. Только
обновите pagecnt_bias для первого дескриптора и фрагментов
оставшаяся программа после XDP.
Позаботьтесь о том, чтобы получить доступ к общей информации только для
фрагментированные буферы, поскольку это позволяет избежать значительных ошибок в кэше. Значение xdp_xmit необходимо обновлять только при запуске программы XDP.
только один раз за пакет. Удалите аргумент указателя xdp_xmit из
Ice_put_rx_mbuf().
Вместо этого установите xdp_xmit в функции Ice_clean_rx_irq().
напрямую. Это позволяет избежать необходимости передавать аргумент и избежать дополнительных
побитовое ИЛИ для каждого буфера в кадре. Переместите приращение локальной переменной ntc, чтобы обеспечить ее обновление *до*.
все вызовы Ice_get_pgcnts() или Ice_put_rx_mbuf() в качестве логики цикла
требует индекс элемента сразу после текущего кадра.
Теперь, когда мы используем индексный указатель в кольце для идентификации пакета, мы не
больше не нужно отслеживать или кэшировать количество фрагментов в rx_ring.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: ice: fix Rx page leak on multi-buffer frames The ice_put_rx_mbuf() function handles calling ice_put_rx_buf() for each buffer in the current frame. This function was introduced as part of handling multi-buffer XDP support in the ice driver. It works by iterating over the buffers from first_desc up to 1 plus the total number of fragments in the frame, cached from before the XDP program was executed. If the hardware posts a descriptor with a size of 0, the logic used in ice_put_rx_mbuf() breaks. Such descriptors get skipped and don't get added as fragments in ice_add_xdp_frag. Since the buffer isn't counted as a fragment, we do not iterate over it in ice_put_rx_mbuf(), and thus we don't call ice_put_rx_buf(). Because we don't call ice_put_rx_buf(), we don't attempt to re-use the page or free it. This leaves a stale page in the ring, as we don't increment next_to_alloc. The ice_reuse_rx_page() assumes that the next_to_alloc has been incremented properly, and that it always points to a buffer with a NULL page. Since this function doesn't check, it will happily recycle a page over the top of the next_to_alloc buffer, losing track of the old page. Note that this leak only occurs for multi-buffer frames. The ice_put_rx_mbuf() function always handles at least one buffer, so a single-buffer frame will always get handled correctly. It is not clear precisely why the hardware hands us descriptors with a size of 0 sometimes, but it happens somewhat regularly with "jumbo frames" used by 9K MTU. To fix ice_put_rx_mbuf(), we need to make sure to call ice_put_rx_buf() on all buffers between first_desc and next_to_clean. Borrow the logic of a similar function in i40e used for this same purpose. Use the same logic also in ice_get_pgcnts(). Instead of iterating over just the number of fragments, use a loop which iterates until the current index reaches to the next_to_clean element just past the current frame. Unlike i40e, the ice_put_rx_mbuf() function does call ice_put_rx_buf() on the last buffer of the frame indicating the end of packet. For non-linear (multi-buffer) frames, we need to take care when adjusting the pagecnt_bias. An XDP program might release fragments from the tail of the frame, in which case that fragment page is already released. Only update the pagecnt_bias for the first descriptor and fragments still remaining post-XDP program. Take care to only access the shared info for fragmented buffers, as this avoids a significant cache miss. The xdp_xmit value only needs to be updated if an XDP program is run, and only once per packet. Drop the xdp_xmit pointer argument from ice_put_rx_mbuf(). Instead, set xdp_xmit in the ice_clean_rx_irq() function directly. This avoids needing to pass the argument and avoids an extra bit-wise OR for each buffer in the frame. Move the increment of the ntc local variable to ensure its updated *before* all calls to ice_get_pgcnts() or ice_put_rx_mbuf(), as the loop logic requires the index of the element just after the current frame. Now that we use an index pointer in the ring to identify the packet, we no longer need to track or cache the number of fragments in the rx_ring.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 17
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.6.78
|
6.7
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.12.14
|
6.12.49
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13.3
|
6.14
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.14.1
|
6.16.9
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.14:-:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.14:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.14:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.14:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.14:rc5:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.14:rc6:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.14:rc7:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.17:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.17:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.17:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.17:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.17:rc5:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.17:rc6:*:*:*:*:*:*
|
— | — |