🇰🇷 한글 설명
Linux 커널 mana 하드웨어 채널 제거 과정에서 메모리 해제 순서 오류로 인한 use-after-free 취약점입니다. IRQ 핸들러가 실행 중인 상태에서 hwc->caller_ctx를 먼저 해제하면, 하드웨어 인터럽트가 해제된 메모리를 접근하여 NULL 포인터 역참조나 메모리 손상을 초래합니다.
💡 쉬운 설명
네트워크 드라이버가 메모리를 정리할 때 순서를 잘못 지켜서 이미 처리 중인 작업이 삭제된 메모리를 참조하게 됩니다. 이는 커널 패닉이나 권한 상승을 유발할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net: mana: fix use-after-free in mana_hwc_destroy_channel() by reordering teardown
A potential race condition exists in mana_hwc_destroy_channel() where
hwc->caller_ctx is freed before the HWC's Completion Queue (CQ) and
Event Queue (EQ) are destroyed. This allows an in-flight CQ interrupt
handler to dereference freed memory, leading to a use-after-free or
NULL pointer dereference in mana_hwc_handle_resp().
mana_smc_teardown_hwc() signals the hardware to stop but does not
synchronize against IRQ handlers already executing on other CPUs. The
IRQ synchronization only happens in mana_hwc_destroy_cq() via
mana_gd_destroy_eq() -> mana_gd_deregister_irq(). Since this runs
after kfree(hwc->caller_ctx), a concurrent mana_hwc_rx_event_handler()
can dereference freed caller_ctx (and rxq->msg_buf) in
mana_hwc_handle_resp().
Fix this by reordering teardown to reverse-of-creation order: destroy
the TX/RX work queues and CQ/EQ before freeing hwc->caller_ctx. This
ensures all in-flight interrupt handlers complete before the memory they
access is freed.
📍 영향받는 시스템
Linux 커널의 mana(Microsoft Azure Network Adapter) 네트워크 드라이버
⚔️ 공격 벡터
로컬 공격자가 특정 네트워크 조건에서 IRQ 처리 중에 채널을 제거하여 race condition 트리거
🛡️ 대응 방법
Linux 커널을 최신 버전으로 업데이트하여 teardown 순서를 creation 순서의 역순으로 변경한 패치 적용
🔧 검증 코드
커널 버전을 확인하고 mana 드라이버 버전이 취약점 패치가 포함된 버전 이상인지 검증합니다.
uname -r && modinfo mana 2>/dev/null | grep -E '^version'