🇰🇷 한글 설명
I3C IBI 서브시스템의 work node 관리 과정에서 동기화 메커니즘이 누락되어 ISR 컨텍스트와 워크큐 스레드 간의 레이스 컨디션이 발생합니다. 이로 인해 공유 리스트가 손상되어 노드가 중복 할당되거나 잘못된 포인터가 반환될 수 있으며, 이는 메모리 오염이나 시스템 충돌로 이어질 수 있습니다.
💡 쉬운 설명
I3C 장치와 통신하는 과정에서 데이터 처리 목록을 관리하는 규칙이 제대로 지켜지지 않아 충돌이 발생할 수 있습니다. 공격자가 특정 장치를 통해 이 충돌을 유도하면 시스템이 멈추거나 오작동할 수 있습니다.
🇺🇸 원문 (English)
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.
📍 영향받는 시스템
I3C IBI 서브시스템을 사용하는 커널 기반 시스템 (drivers/i3c/i3c_ibi_workq.c 포함 버전)
⚔️ 공격 벡터
물리적 접근을 통해 I3C 버스에 연결된 주변 장치를 제어하여 고빈도 인터럽트를 발생시켜 레이스 컨디션 유도
🛡️ 대응 방법
sys_slist_get() 및 sys_slist_append() 호출 시 k_spinlock(ibi_work_lock)을 사용하여 동기화 처리가 적용된 ibi_work_alloc()/ibi_work_free() 헬퍼 함수로 업데이트
🔧 검증 코드
명령어 결과에 ibi_work_lock을 사용하는 ibi_work_alloc 또는 ibi_work_free 함수가 포함되어 있으면 패치가 적용된 것입니다.
grep -r "ibi_work_lock" drivers/i3c/i3c_ibi_workq.c
📊 CVSS Vector String
CVSS:3.1/AV:P/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L
💻 영향받는 소프트웨어
Windows iSCSI Target Service