🇰🇷 한글 설명
Linux 커널의 ext4 파일 시스템에서 파일 시스템 종료 시 dirty clusters 카운터가 중복으로 감소하는 취약점이 발견되었습니다. 이 문제는 ext4_mb_new_blocks() 함수와 ext4_mb_mark_diskspace_used() 사이의 에러 처리 경로에서 발생하며, 카운터 값이 -1이 되는 불일치를 유발합니다.
💡 쉬운 설명
파일 시스템을 종료할 때 데이터 관리용 숫자를 두 번 빼버리는 계산 오류가 발생하는 문제입니다. 이로 인해 시스템 내부 데이터 기록의 일관성이 깨질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ext4: fix dirtyclusters double decrement on fs shutdown
fstests test generic/388 occasionally reproduces a warning in
ext4_put_super() associated with the dirty clusters count:
WARNING: CPU: 7 PID: 76064 at fs/ext4/super.c:1324 ext4_put_super+0x48c/0x590 [ext4]
Tracing the failure shows that the warning fires due to an
s_dirtyclusters_counter value of -1. IOW, this appears to be a
spurious decrement as opposed to some sort of leak. Further tracing
of the dirty cluster count deltas and an LLM scan of the resulting
output identified the cause as a double decrement in the error path
between ext4_mb_mark_diskspace_used() and the caller
ext4_mb_new_blocks().
First, note that generic/388 is a shutdown vs. fsstress test and so
produces a random set of operations and shutdown injections. In the
problematic case, the shutdown triggers an error return from the
ext4_handle_dirty_metadata() call(s) made from
ext4_mb_mark_context(). The changed value is non-zero at this point,
so ext4_mb_mark_diskspace_used() does not exit after the error
bubbles up from ext4_mb_mark_context(). Instead, the former
decrements both cluster counters and returns the error up to
ext4_mb_new_blocks(). The latter falls into the !ar->len out path
which decrements the dirty clusters counter a second time, creating
the inconsistency.
To avoid this problem and simplify ownership of the cluster
reservation in this codepath, lift the counter reduction to a single
place in the caller. This makes it more clear that
ext4_mb_new_blocks() is responsible for acquiring cluster
reservation (via ext4_claim_free_clusters()) in the !delalloc case
as well as releasing it, regardless of whether it ends up consumed
or returned due to failure.
📍 영향받는 시스템
Linux kernel (ext4 파일 시스템을 사용하는 모든 시스템)
⚔️ 공격 벡터
로컬 공격자가 파일 시스템에 오류를 유발하는 특정 작업과 종료를 동시에 수행하여 발생 가능
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 ext4 카운터 감소 로직 수정 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 최신 패치 버전인지 확인