🇰🇷 한글 설명
Linux 커널의 ext4 파일시스템에서 온라인 리사이징 중 발생하는 데이터 손상 취약점입니다. resize_inode가 비활성화된 16TiB 이상의 대용량 파일시스템에서 메타 블록 그룹 경계를 넘을 때 백업 블록 그룹 디스크립터가 손상됩니다. ext4_flex_group_add 함수에서 메타_bg 레이아웃 변환 시 일관성 검사 부족으로 인한 결함입니다.
💡 쉬운 설명
대용량 Linux 저장소를 확장할 때 파일 시스템이 손상될 수 있는 버그입니다. 특히 16TB 이상의 매우 큰 드라이브에서 온라인 리사이징 작업 중에 일부 데이터가 손상될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ext4: fix corruption during on-line resize
We observed a corruption during on-line resize of a file system that is
larger than 16 TiB with 4k block size. With having more then 2^32 blocks
resize_inode is turned off by default by mke2fs. The issue can be
reproduced on a smaller file system for convenience by explicitly
turning off resize_inode. An on-line resize across an 8 GiB boundary (the
size of a meta block group in this setup) then leads to a corruption:
dev=/dev/<some_dev> # should be >= 16 GiB
mkdir -p /corruption
/sbin/mke2fs -t ext4 -b 4096 -O ^resize_inode $dev $((2 * 2**21 - 2**15))
mount -t ext4 $dev /corruption
dd if=/dev/zero bs=4096 of=/corruption/test count=$((2*2**21 - 4*2**15))
sha1sum /corruption/test
# 79d2658b39dcfd77274e435b0934028adafaab11 /corruption/test
/sbin/resize2fs $dev $((2*2**21))
# drop page cache to force reload the block from disk
echo 1 > /proc/sys/vm/drop_caches
sha1sum /corruption/test
# 3c2abc63cbf1a94c9e6977e0fbd72cd832c4d5c3 /corruption/test
2^21 = 2^15*2^6 equals 8 GiB whereof 2^15 is the number of blocks per
block group and 2^6 are the number of block groups that make a meta
block group.
The last checksum might be different depending on how the file is laid
out across the physical blocks. The actual corruption occurs at physical
block 63*2^15 = 2064384 which would be the location of the backup of the
meta block group's block descriptor. During the on-line resize the file
system will be converted to meta_bg starting at s_first_meta_bg which is
2 in the example - meaning all block groups after 16 GiB. However, in
ext4_flex_group_add we might add block groups that are not part of the
first meta block group yet. In the reproducer we achieved this by
substracting the size of a whole block group from the point where the
meta block group would start. This must be considered when updating the
backup block group descriptors to follow the non-meta_bg layout. The fix
is to add a test whether the group to add is already part of the meta
block group or not.
📍 영향받는 시스템
Linux 커널 (특히 6.0 이상), ext4 파일시스템 사용 시스템, 16TiB 이상 용량, resize_inode 비활성화 상태
⚔️ 공격 벡터
로컬 권한 필요, 온라인 리사이징(resize2fs) 작업 수행 시 자동 발생
🛡️ 대응 방법
Linux 커널 패치 적용 (CVE-2024-35807 수정사항 포함된 버전 설치)
🔧 검증 코드
커널 버전 확인 후 공식 보안 권고에 명시된 패치된 버전 이상인지 확인하세요. 추가로 'mount | grep ext4'로 ext4 사용 여부를 확인할 수 있습니다.