🇰🇷 한글 설명
Linux 커널의 EROFS 파일 시스템에서 정렬되지 않은 압축 익스텐트(unaligned compressed extents)를 처리할 때 관리되는 캐시의 레이스 컨디션(Race Condition) 취약점이 발견되었습니다. 특정 상황에서 동일한 folio가 중복으로 추가되어 데이터 무결성 문제가 발생할 수 있으며, 이는 folio의 private 플래그를 명시적으로 해제함으로써 해결되었습니다.
💡 쉬운 설명
파일을 읽고 쓰는 과정에서 두 작업이 동시에 같은 메모리 공간을 건드리면서 충돌이 발생하는 문제입니다. 이로 인해 데이터가 깨지거나 시스템 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
erofs: fix managed cache race for unaligned extents
After unaligned compressed extents were introduced, the following race
could occur:
[Thread 1] [Thread 2]
(z_erofs_fill_bio_vec)
<handle a Z_EROFS_PREALLOCATED_FOLIO folio>
...
filemap_add_folio (1)
(z_erofs_bind_cache)
<the same folio is found..>
..
..
folio_attach_private (2)
filemap_add_folio (3) again
Since (1) is executed but (2) hasn't been executed yet, it's possible
that another thread finds the same managed folio in z_erofs_bind_cache()
for a different pcluster and calls filemap_add_folio() again since
folio->private is still Z_EROFS_PREALLOCATED_FOLIO.
Fix this by explicitly clearing folio->private before making the folio
visible in the managed cache so that another pcluster can simply wait
on the locked managed folio as what we did for other shared cases [1].
This only impacts unaligned data compression (`-E48bit` with zstd,
for example).
[1] Commit 9e2f9d34dd12 ("erofs: handle overlapped pclusters out of
crafted images properly") was originally introduced to handle crafted
overlapped extents, but it addresses unaligned extents as well.
📍 영향받는 시스템
unaligned data compression(-E48bit with zstd 등)을 사용하는 Linux 커널
⚔️ 공격 벡터
정교하게 조작된 EROFS 이미지 파일을 마운트하여 레이스 컨디션을 유도하는 방식
🛡️ 대응 방법
해당 취약점이 수정된 최신 버전의 Linux 커널로 업데이트
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 취약점이 해결된 패치 버전인지 확인합니다.