🇰🇷 한글 설명
Linux 커널의 ext4 파일시스템에서 부트로더 inode를 초기화할 때 i_disksize를 0으로 설정하지 않아, i_size와 i_disksize가 불일치하면서 커널 경고가 발생하는 문제입니다. 패치는 초기화 시 i_disksize와 i_size를 모두 0으로 설정합니다.
💡 쉬운 설명
손상된 ext4 파일시스템에서 특정 기능을 사용하면 리눅스 커널이 경고를 출력하며 불안정해질 수 있습니다. 커널 업데이트로 파일 크기 정보를 올바르게 초기화하도록 수정되었습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ext4: zero i_disksize when initializing the bootloader inode
If the boot loader inode has never been used before, the
EXT4_IOC_SWAP_BOOT inode will initialize it, including setting the
i_size to 0. However, if the "never before used" boot loader has a
non-zero i_size, then i_disksize will be non-zero, and the
inconsistency between i_size and i_disksize can trigger a kernel
warning:
WARNING: CPU: 0 PID: 2580 at fs/ext4/file.c:319
CPU: 0 PID: 2580 Comm: bb Not tainted 6.3.0-rc1-00004-g703695902cfa
RIP: 0010:ext4_file_write_iter+0xbc7/0xd10
Call Trace:
vfs_write+0x3b1/0x5c0
ksys_write+0x77/0x160
__x64_sys_write+0x22/0x30
do_syscall_64+0x39/0x80
Reproducer:
1. create corrupted image and mount it:
mke2fs -t ext4 /tmp/foo.img 200
debugfs -wR "sif <5> size 25700" /tmp/foo.img
mount -t ext4 /tmp/foo.img /mnt
cd /mnt
echo 123 > file
2. Run the reproducer program:
posix_memalign(&buf, 1024, 1024)
fd = open("file", O_RDWR | O_DIRECT);
ioctl(fd, EXT4_IOC_SWAP_BOOT);
write(fd, buf, 1024);
Fix this by setting i_disksize as well as i_size to zero when
initiaizing the boot loader inode.
📍 영향받는 시스템
수정 이전의 Linux 커널을 사용하는 ext4 파일시스템 환경 (6.3-rc1 등 해당 시점 이전 버전)
⚔️ 공격 벡터
조작된 ext4 이미지를 마운트한 뒤 EXT4_IOC_SWAP_BOOT ioctl과 O_DIRECT 쓰기를 수행해 커널 경고를 유발하는 방식이며, 로컬 사용자 권한이 필요합니다.
🛡️ 대응 방법
배포판 제공 최신 커널 패키지로 업데이트하여 해당 커밋이 포함된 버전을 사용합니다.
🔧 검증 코드
출력된 커널 버전을 배포판의 보안 공지나 changelog와 대조해 해당 패치가 포함되었는지 확인하며, 패치 이전 버전이면 업데이트가 필요합니다.