🇰🇷 한글 설명
Linux 커널의 iomap 구성 요소에서 버퍼드 읽기 실패 시 오류 보고 과정 중 NULL 포인터 역참조가 발생할 수 있는 취약점입니다. 읽기 작업 완료 후 데이터 처리가 완료되기 전에 다른 프로세스가 folio의 매핑을 해제할 경우 시스템 충돌이 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터가 파일을 읽다가 오류가 났을 때, 오류 내용을 기록하려다 이미 사라진 정보를 참조하여 시스템이 멈추거나 꺼질 수 있는 문제입니다. 데이터 읽기 순서가 꼬이면서 발생하는 일종의 타이밍 문제입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
iomap: avoid potential null folio->mapping deref during error reporting
When a buffered read fails, iomap_finish_folio_read() reports the error
with fserror_report_io(folio->mapping->host, ...). This is called after
ifs->read_bytes_pending has been decremented by the bytes attempted to
be read.
For a folio split across multiple read completions, the folio is only
guaranteed to stay locked while read_bytes_pending > 0. Once
iomap_finish_folio_read() decrements read_bytes_pending, another
in-flight read can complete and end the read on the folio, which unlocks
it. This allows truncate logic to run and detach the folio (set
folio->mapping to NULL). The error reporting path then can dereference a
NULL folio->mapping. As reported by Sam Sun, this is the race that can
occur:
CPU0: failed completion CPU1: final completion CPU2: truncate
----------------------- ---------------------- --------------
read_bytes_pending -= len
finished = false
/* preempted before
fserror_report_io() */
read_bytes_pending -= len
finished = true
folio_end_read()
truncate clears
folio->mapping
fserror_report_io(
folio->mapping->host, ...)
^ NULL deref
Fix this by reporting the error first before decrementing
ifs->read_bytes_pending.
📍 영향받는 시스템
Linux Kernel (iomap 관련 모듈을 사용하는 시스템)
⚔️ 공격 벡터
로컬 공격자가 특정 파일 읽기 및 파일 크기 조절(truncate) 작업을 동시에 수행하여 레이스 컨디션 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인