🇰🇷 한글 설명
Linux 커널 io_uring에서 파일시스템이 nowait 버퍼드 읽기를 지원하지 않을 때 fget() 참조가 누수되는 문제가 수정되었습니다. ocfs2 등에서 io_uring 읽기 작업 후 umount가 실패하는 현상이 원인이며, req->file을 중복 할당하지 않도록 수정되었습니다.
💡 쉬운 설명
io_uring이라는 리눅스 비동기 입출력 기능에서 파일 참조가 해제되지 않고 남는 버그입니다. 이로 인해 파일시스템을 unmount할 수 없게 되는 문제가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
io_uring: fix fget leak when fs don't support nowait buffered read
Heming reported a BUG when using io_uring doing link-cp on ocfs2. [1]
Do the following steps can reproduce this BUG:
mount -t ocfs2 /dev/vdc /mnt/ocfs2
cp testfile /mnt/ocfs2/
./link-cp /mnt/ocfs2/testfile /mnt/ocfs2/testfile.1
umount /mnt/ocfs2
Then umount will fail, and it outputs:
umount: /mnt/ocfs2: target is busy.
While tracing umount, it blames mnt_get_count() not return as expected.
Do a deep investigation for fget()/fput() on related code flow, I've
finally found that fget() leaks since ocfs2 doesn't support nowait
buffered read.
io_issue_sqe
|-io_assign_file // do fget() first
|-io_read
|-io_iter_do_read
|-ocfs2_file_read_iter // return -EOPNOTSUPP
|-kiocb_done
|-io_rw_done
|-__io_complete_rw_common // set REQ_F_REISSUE
|-io_resubmit_prep
|-io_req_prep_async // override req->file, leak happens
This was introduced by commit a196c78b5443 in v5.18. Fix it by don't
re-assign req->file if it has already been assigned.
[1] https://lore.kernel.org/ocfs2-devel/
[email protected]/T/#t
📍 영향받는 시스템
Linux 커널 5.18 이상 (io_uring 사용 환경, 특히 ocfs2 등 nowait 버퍼드 읽기 미지원 파일시스템)
⚔️ 공격 벡터
로컬 사용자가 io_uring으로 특정 파일시스템에 읽기 작업을 반복 수행하여 참조 누수를 유발해 서비스 거부(unmount 불가 등)를 일으킬 수 있음
🛡️ 대응 방법
커널을 해당 CVE 수정이 포함된 최신 안정 버전으로 업데이트하고 재부팅하거나, 배포판의 보안 업데이트를 적용
🔧 검증 코드
출력된 커널 버전이 CVE 수정이 반영된 버전(배포판 패치 기준 확인 필요)보다 최신인지 배포판 보안 공지와 대조하여 판단