🇰🇷 한글 설명
Linux 커널의 io_uring/rw 구성 요소에서 쓰기 작업 완료 처리가 지연되어 발생하는 교착 상태(Deadlock) 취약점입니다. 쓰기 작업 완료 처리가 실행 대기 중인 작업(task_work)으로 넘어가면서, 파일 시스템 동결(freeze) 과정과 충돌하여 시스템이 응답하지 않는 상태에 빠질 수 있습니다.
💡 쉬운 설명
파일을 쓰는 작업이 끝났다는 신호를 보내는 방식이 잘못되어, 시스템이 파일을 잠그려고 할 때 서로 기다리다가 멈춰버리는 문제입니다. 이로 인해 시스템이 먹통이 될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
io_uring/rw: end write accounting from ->ki_complete
Commit b000145e9907 moved both the fsnotify calls and the write
accounting out of the kiocb completion handler and into the
io_req_rw_complete() task_work. However, only the fsnotify part actually
needed to move as it may sleep. Ending the write accounting is just a
percpu_up_read() on the superblock writers sem.
Deferring it is a problem, because it makes dropping SB_FREEZE_WRITE
protection depend on the ring owner getting to running task_work. But
the task may be blocked in freeze_super(), causing it to never get to
that:
task io-wq worker
--------------------------------------------------------------
io_write()
io_kiocb_start_write() (takes sb_writers, hidden from
lockdep by __sb_writers_release)
write_iter() -> -EIOCBQUEUED
ioctl(FS_IOC_SHUTDOWN)
bdev_freeze()
freeze_super()
percpu_down_write() <- waits for the reader above
io_write()
kiocb_start_write()
percpu_down_read() <- queued
behind the
writer
<bio completes>
io_complete_rw()
queues io_req_rw_complete() <- never runs, task is in D state
End the write from io_complete_rw() instead, and leave only the fsnotify
calls in task_work.
📍 영향받는 시스템
io_uring을 사용하는 Linux 커널 버전 (패치 적용 전 버전)
⚔️ 공격 벡터
특정 파일 시스템 작업(freeze)과 io_uring을 통한 쓰기 작업을 동시에 수행하여 교착 상태 유도
🛡️ 대응 방법
커널 패치(Commit b000145e9907 포함 버전)를 적용하여 쓰기 완료 처리를 즉시 수행하도록 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인