🇰🇷 한글 설명
Linux kernel ext4 파일시스템 초기화 중 percpu_counter 구조체가 사용되기 전에 초기화되지 않아 발생하는 kernel panic 취약점입니다. ext4_percpu_param_init() 함수의 실행 순서를 ext4_mb_init() 이전으로 변경하여 해결됩니다.
💡 쉬운 설명
리눅스 커널의 ext4 파일시스템이 시작될 때 특정 구조체를 사용하기 전에 준비하지 않아 시스템이 멈추는 문제입니다. 준비 작업의 순서를 바꾸면 고쳐집니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ext4: move ext4_percpu_param_init() before ext4_mb_init()
When running `kvm-xfstests -c ext4/1k -C 1 generic/383` with the
`DOUBLE_CHECK` macro defined, the following panic is triggered:
==================================================================
EXT4-fs error (device vdc): ext4_validate_block_bitmap:423:
comm mount: bg 0: bad block bitmap checksum
BUG: unable to handle page fault for address: ff110000fa2cc000
PGD 3e01067 P4D 3e02067 PUD 0
Oops: Oops: 0000 [#1] SMP NOPTI
CPU: 0 UID: 0 PID: 2386 Comm: mount Tainted: G W
6.18.0-gba65a4e7120a-dirty #1152 PREEMPT(none)
RIP: 0010:percpu_counter_add_batch+0x13/0xa0
Call Trace:
<TASK>
ext4_mark_group_bitmap_corrupted+0xcb/0xe0
ext4_validate_block_bitmap+0x2a1/0x2f0
ext4_read_block_bitmap+0x33/0x50
mb_group_bb_bitmap_alloc+0x33/0x80
ext4_mb_add_groupinfo+0x190/0x250
ext4_mb_init_backend+0x87/0x290
ext4_mb_init+0x456/0x640
__ext4_fill_super+0x1072/0x1680
ext4_fill_super+0xd3/0x280
get_tree_bdev_flags+0x132/0x1d0
vfs_get_tree+0x29/0xd0
vfs_cmd_create+0x59/0xe0
__do_sys_fsconfig+0x4f6/0x6b0
do_syscall_64+0x50/0x1f0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
==================================================================
This issue can be reproduced using the following commands:
mkfs.ext4 -F -q -b 1024 /dev/sda 5G
tune2fs -O quota,project /dev/sda
mount /dev/sda /tmp/test
With DOUBLE_CHECK defined, mb_group_bb_bitmap_alloc() reads
and validates the block bitmap. When the validation fails,
ext4_mark_group_bitmap_corrupted() attempts to update
sbi->s_freeclusters_counter. However, this percpu_counter has not been
initialized yet at this point, which leads to the panic described above.
Fix this by moving the execution of ext4_percpu_param_init() to occur
before ext4_mb_init(), ensuring the per-CPU counters are initialized
before they are used.
📍 영향받는 시스템
Linux kernel 6.18.0 이전 버전, ext4 파일시스템 사용 시스템, 특히 1024 바이트 블록 크기 및 quota 옵션 활성화 시
⚔️ 공격 벡터
로컬에서 ext4 파일시스템 마운트 시도 (원격 공격 불가, 로컬 DoS)
🛡️ 대응 방법
Linux kernel을 수정된 버전으로 업데이트하거나, ext4_percpu_param_init()을 ext4_mb_init() 전에 호출하는 패치 적용
🔧 검증 코드
커널 버전이 6.18 이전이거나 패치 전 버전이면 Vulnerable로 표시됩니다. 정확한 확인은 /proc/version 또는 커널 changelog 검토 필요
uname -r | grep -E '(6\.(1[0-7]|9|10|11|12)\.|7\.)' && echo 'Vulnerable' || echo 'Check manually'