В ядре Linux устранена следующая уязвимость:
net: ks8851: Обработка программных прерываний в конце потока IRQ для устранения зависания. Поток ks8851_irq() может вызвать ks8851_rx_pkts() в случае, если есть
любые пакеты в MAC FIFO, который вызывает netif_rx(). Это netif_rx()
реализация охраняется функциями local_bh_disable() и local_bh_enable().
Функция local_bh_enable() может вызвать do_softirq() для запуска softirq в случае, если
любые ожидают рассмотрения. Одним из мягких прерываний является net_rx_action, который в конечном итоге
достигает обратного вызова драйвера .start_xmit. Если это произойдет, система
висит.
Вся цепочка вызовов приведена ниже:
ks8851_start_xmit_par из netdev_start_xmit
netdev_start_xmit из dev_hard_start_xmit
dev_hard_start_xmit из sch_direct_xmit
sch_direct_xmit из __dev_queue_xmit
__dev_queue_xmit из __neigh_update
__neigh_update из neigh_update
neigh_update из arp_process.constprop.0
arp_process.constprop.0 из __netif_receive_skb_one_core
__netif_receive_skb_one_core из процесса_backlog
process_backlog из __napi_poll.constprop.0
__napi_poll.constprop.0 из net_rx_action
net_rx_action из __do_softirq
__do_softirq из call_with_stack
call_with_stack из do_softirq
do_softirq из __local_bh_enable_ip
__local_bh_enable_ip из netif_rx
netif_rx от ks8851_irq
ks8851_irq из irq_thread_fn
irq_thread_fn из irq_thread
irq_thread из kthread
kthread из ret_from_fork
Зависание происходит из-за того, что ks8851_irq() сначала блокирует спин-блокировку.
ks8851_par.c ks8851_lock_par() spin_lock_irqsave(&ksp->lock, ...)
и когда спин-блокировка заблокирована, вызывает netif_rx(). Как только казнь
достигает ks8851_start_xmit_par(), он снова вызывает ks8851_lock_par()
который пытается снова запросить уже заблокированную спин-блокировку, и
зависание происходит. Переместите вызов do_softirq() за пределы раздела, защищенного спин-блокировкой.
ks8851_irq(), отключив BH вокруг всей защищенной спин-блокировки.
раздел обработчика ks8851_irq().
Поместите local_bh_enable() вне
раздел, защищенный спин-блокировкой, чтобы он мог вызвать do_softirq()
без удержания спин-блокировки ks8851_par.c ks8851_lock_par() и
безопасно вызовите ks8851_start_xmit_par(), не пытаясь заблокировать
уже заблокированный спинлок. Поскольку ks8851_irq() защищен с помощью local_bh_disable()/local_bh_enable()
теперь замените netif_rx() на __netif_rx(), который не дублирует
Вызовы local_bh_disable()/local_bh_enable().
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: net: ks8851: Handle softirqs at the end of IRQ thread to fix hang The ks8851_irq() thread may call ks8851_rx_pkts() in case there are any packets in the MAC FIFO, which calls netif_rx(). This netif_rx() implementation is guarded by local_bh_disable() and local_bh_enable(). The local_bh_enable() may call do_softirq() to run softirqs in case any are pending. One of the softirqs is net_rx_action, which ultimately reaches the driver .start_xmit callback. If that happens, the system hangs. The entire call chain is below: ks8851_start_xmit_par from netdev_start_xmit netdev_start_xmit from dev_hard_start_xmit dev_hard_start_xmit from sch_direct_xmit sch_direct_xmit from __dev_queue_xmit __dev_queue_xmit from __neigh_update __neigh_update from neigh_update neigh_update from arp_process.constprop.0 arp_process.constprop.0 from __netif_receive_skb_one_core __netif_receive_skb_one_core from process_backlog process_backlog from __napi_poll.constprop.0 __napi_poll.constprop.0 from net_rx_action net_rx_action from __do_softirq __do_softirq from call_with_stack call_with_stack from do_softirq do_softirq from __local_bh_enable_ip __local_bh_enable_ip from netif_rx netif_rx from ks8851_irq ks8851_irq from irq_thread_fn irq_thread_fn from irq_thread irq_thread from kthread kthread from ret_from_fork The hang happens because ks8851_irq() first locks a spinlock in ks8851_par.c ks8851_lock_par() spin_lock_irqsave(&ksp->lock, ...) and with that spinlock locked, calls netif_rx(). Once the execution reaches ks8851_start_xmit_par(), it calls ks8851_lock_par() again which attempts to claim the already locked spinlock again, and the hang happens. Move the do_softirq() call outside of the spinlock protected section of ks8851_irq() by disabling BHs around the entire spinlock protected section of ks8851_irq() handler. Place local_bh_enable() outside of the spinlock protected section, so that it can trigger do_softirq() without the ks8851_par.c ks8851_lock_par() spinlock being held, and safely call ks8851_start_xmit_par() without attempting to lock the already locked spinlock. Since ks8851_irq() is protected by local_bh_disable()/local_bh_enable() now, replace netif_rx() with __netif_rx() which is not duplicating the local_bh_disable()/local_bh_enable() calls.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 6
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.8
|
6.1.87
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.2
|
6.6.28
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.7
|
6.8.7
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.9:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.9:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.9:rc3:*:*:*:*:*:*
|
— | — |