🇰🇷 한글 설명
Linux 커널 ext4 파일시스템에서 간접 블록 매핑 파일의 블록 할당 시 32비트 제한을 우회하여 지원되지 않는 블록이 할당될 수 있는 취약점입니다. 블록 그룹 스캔 과정에서 범위를 초과한 그룹이 선택되어 파일시스템 무결성 손상이 가능합니다.
💡 쉬운 설명
Linux 파일 저장 시스템에서 파일 데이터가 허용되지 않는 위치에 저장될 수 있는 버그입니다. 데이터 손상이나 시스템 불안정을 초래할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ext4: handle wraparound when searching for blocks for indirect mapped blocks
Commit 4865c768b563 ("ext4: always allocate blocks only from groups
inode can use") restricts what blocks will be allocated for indirect
block based files to block numbers that fit within 32-bit block
numbers.
However, when using a review bot running on the latest Gemini LLM to
check this commit when backporting into an LTS based kernel, it raised
this concern:
If ac->ac_g_ex.fe_group is >= ngroups (for instance, if the goal
group was populated via stream allocation from s_mb_last_groups),
then start will be >= ngroups.
Does this allow allocating blocks beyond the 32-bit limit for
indirect block mapped files? The commit message mentions that
ext4_mb_scan_groups_linear() takes care to not select unsupported
groups. However, its loop uses group = *start, and the very first
iteration will call ext4_mb_scan_group() with this unsupported
group because next_linear_group() is only called at the end of the
iteration.
After reviewing the code paths involved and considering the LLM
review, I determined that this can happen when there is a file system
where some files/directories are extent-mapped and others are
indirect-block mapped. To address this, add a safety clamp in
ext4_mb_scan_groups().
📍 영향받는 시스템
Linux 커널 4.x ~ 6.x 버전의 모든 배포판 (ext4 파일시스템 사용)
⚔️ 공격 벡터
로컬 공격자가 특정 파일 형식의 파일을 생성하여 비정상적인 블록 할당 트리거
🛡️ 대응 방법
Linux 커널 패치 적용 (ext4_mb_scan_groups()에 블록 범위 안전 장치 추가)
🔧 검증 코드
커널 버전 확인 후 4.x-6.x 대이고 ext4 사용 중이면 패치 필요 여부 확인
uname -r && cat /proc/version | grep -i ext4