Подсистема I3C IBI в драйверах/i3c/i3c_ibi_workq.c распределяет статически выделенные рабочие узлы через свободный список i3c_ibi_work_nodes_free, реализованный как простой sys_slist_t, который не обеспечивает синхронизацию. Помощники выделения (i3c_ibi_work_enqueue, i3c_ibi_work_enqueue_target_irq, i3c_ibi_work_enqueue_hotjoin, i3c_ibi_work_enqueue_controller_request, i3c_ibi_work_enqueue_cb) вызывают sys_slist_get() непосредственно из контекста ISR, а обработчик рабочей очереди i3c_ibi_work_handler() вернул узлы с помощью sys_slist_append() из потока рабочей очереди без блокировки с обеих сторон. Поскольку sys_slist_get() и sys_slist_append() не являются ни атомарными, ни защищенными от прерываний, прерывание IBI, которое срабатывает, когда поток рабочей очереди находится в середине добавления (или при действительно параллельном доступе в CONFIG_SMP), гоняется в общем списке.
Это нарушает связь списка: узел может быть передан двум потребителям, узел может быть потерян или указатели начала/хвоста могут остаться несогласованными, поэтому sys_slist_get() возвращает устаревший или мусорный указатель. В случае двойной раздачи последующий memcpy(ibi_node, ibi_work, sizeof(*ibi_node)) перезаписывает узел, все еще находящийся в работе; указатель мусора превращает тот же memcpy в запись за пределами границ. Гонка управляется трафиком шины I3C — запросы IBI, горячего соединения и роли контроллера исходят от целевых устройств на шине, а I3C поддерживает устройства с горячим присоединением.
Злоумышленник, управляющий периферийным устройством I3C на межчиповой шине платы, может генерировать высокочастотные прерывания, рассчитанные на конфликт со свободной работой. Эксплуатация требует физического доступа к шине и выигрыша в узком временном окне; наиболее реалистичным последствием является сбой или зависание (отказ в обслуживании), при котором возможно повреждение памяти, но его трудно контролировать. Исправление оборачивает все операции sys_slist_get()/sys_slist_append() со свободным списком в новые помощники ibi_work_alloc()/ibi_work_free(), каждый из которых защищен k_spinlock (ibi_work_lock), завершая гонку между ISR и контекстами потоков.
Показать оригинальное описание (EN)
The I3C IBI subsystem in drivers/i3c/i3c_ibi_workq.c hands out statically-allocated work nodes through a free-list i3c_ibi_work_nodes_free implemented as a plain sys_slist_t, which provides no synchronization. The allocation helpers (i3c_ibi_work_enqueue, i3c_ibi_work_enqueue_target_irq, i3c_ibi_work_enqueue_hotjoin, i3c_ibi_work_enqueue_controller_request, i3c_ibi_work_enqueue_cb) called sys_slist_get() directly from ISR context, while the workqueue handler i3c_ibi_work_handler() returned nodes with sys_slist_append() from the workqueue thread, with no lock on either side. Because sys_slist_get() and sys_slist_append() are neither atomic nor interrupt-safe, an IBI interrupt that fires while the workqueue thread is mid-append (or a truly parallel access under CONFIG_SMP) races on the shared list. This corrupts the list linkage: a node may be handed to two consumers, a node may be lost, or the head/tail pointers may be left inconsistent so sys_slist_get() returns a stale or garbage pointer. In the double-hand-out case the subsequent memcpy(ibi_node, ibi_work, sizeof(*ibi_node)) overwrites a node still in flight; a garbage pointer turns the same memcpy into an out-of-bounds write. The race is driven by I3C bus traffic — IBIs, hot-joins, and controller-role requests originate from target devices on the bus, and I3C supports hot-joining devices. An attacker controlling an I3C peripheral on the board's chip-to-chip bus can generate high-frequency interrupts timed to collide with the free operation. Exploitation requires physical access to the bus and winning a narrow timing window; the most realistic impact is a crash or hang (denial of service), with memory corruption possible but hard to control. The fix wraps all free-list sys_slist_get()/sys_slist_append() operations in the new ibi_work_alloc()/ibi_work_free() helpers, each guarded by a k_spinlock (ibi_work_lock), closing the race across ISR and thread contexts.
Характеристики атаки
Последствия
Строка CVSS v3.1