🇰🇷 한글 설명
Linux 커널의 atmel-mci 드라이버에서 레이스 컨디션으로 인한 Use-After-Free(UAF) 취약점이 발견되었습니다. 모듈 제거 과정에서 인터럽트나 타이머에 의해 예약된 작업이 완료되기 전에 메모리가 해제되어 발생합니다.
💡 쉬운 설명
컴퓨터 부품을 제거하는 과정에서, 아직 실행 중인 작업이 있는데 메모리를 먼저 지워버려 발생하는 오류입니다. 이로 인해 시스템이 멈추거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mmc: atmel-mci: Fix use-after-free in atmci_remove due to race condition
In atmci_probe, &host->bh_work is bound with atmci_work_func, and
atmci_interrupt, atmci_timeout_timer and atmci_dma_complete can all
queue this work on system_bh_wq.
If we remove the module, atmci_remove makes cleanup and the memory
allocated for host with devm_kzalloc() is released after the remove
callback returns, while the work mentioned above may still be pending
or running. The sequence of operations that may lead to a UAF bug is
as follows:
CPU0 CPU1
| atmci_interrupt
| queue_work(system_bh_wq,
| &host->bh_work)
atmci_remove |
atmci_cleanup_slot(...) |
atmci_writel(host, ATMCI_IDR, ~0UL) |
timer_delete_sync(&host->timer) |
dma_release_channel(host->dma.chan) |
free_irq(platform_get_irq(pdev, 0), host) |
| atmci_work_func
| // use host
// devm resources released after |
// remove returns, host is freed |
| // use host (use-after-free)
Fix it by canceling the work after all the sources that can schedule
it (IRQ handler, timeout timer and DMA completion callback) have been
stopped, and before proceeding with the remaining cleanup in
atmci_remove.
📍 영향받는 시스템
Linux kernel (atmel-mci driver 포함 버전)
⚔️ 공격 벡터
로컬 공격자가 특정 하드웨어 드라이버 모듈을 제거하는 과정을 유도하여 메모리 오류 유발
🛡️ 대응 방법
커널 패치를 적용하여 모듈 제거 시 작업(work)을 먼저 취소하도록 수정된 최신 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 최신 패치 버전인지 확인