🇰🇷 한글 설명
Linux 커널의 Btrfs 파일 시스템에서 Zoned 파일 시스템 사용 시 메타데이터 쓰기 작업과 트랜잭션 커밋 작업 간의 데드락(Deadlock) 취약점이 발견되었습니다. 특정 상황에서 메타데이터 쓰기 루프가 잠금(lock)을 유지한 채 트랜잭션 완료를 기다리게 되어 시스템이 멈추는 현상이 발생합니다.
💡 쉬운 설명
컴퓨터가 파일을 저장하는 과정에서 두 가지 작업이 서로 상대방의 작업이 끝나기만을 기다리며 무한히 대기하는 상태에 빠지는 문제입니다. 이로 인해 시스템이 응답하지 않고 멈추는 현상이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
btrfs: zoned: fix deadlock between metadata writeback and transaction commit
When writing out metadata extent buffers in a zoned filesystem,
btree_writepages() holds fs_info->zoned_meta_io_lock across the whole
writeback loop, including the call to btrfs_check_meta_write_pointer() ->
check_bg_is_active().
For the tree-log block group, check_bg_is_active() may fail to activate
the zone and fall back to btrfs_zone_finish_one_bg() to free an active
zone. That path waits for the running transaction to commit while still
holding zoned_meta_io_lock, but the committer needs that same lock to
write out the tree extents, so the two tasks deadlock:
Task A (kworker, metadata writeback) Task B (fsstress, transaction commit)
------------------------------------ -------------------------------------
wb_workfn() btrfs_commit_transaction(T)
btree_writepages() btrfs_write_and_wait_transaction()
btrfs_zoned_meta_io_lock() btrfs_write_marked_extents()
btrfs_check_meta_write_pointer() btree_writepages()
check_bg_is_active() [treelog_bg] btrfs_zoned_meta_io_lock()
btrfs_zone_finish_one_bg() <blocks on zoned_meta_io_lock,
btrfs_zone_finish() held by Task A>
do_zone_finish()
btrfs_inc_block_group_ro()
btrfs_wait_for_commit()
<blocks waiting for commit
of transaction T, done by
Task B>
The sibling branch in check_bg_is_active() already drops zoned_meta_io_lock
around do_zone_finish() for this exact reason. Do the same in the tree-log
branch: release the lock around btrfs_zone_finish_one_bg() and re-acquire
it afterwards. The lock only protects fs_info->active_{meta,system}_bg,
which this branch does not touch, and ctx->zoned_bg keeps a reference to
the block group across the unlock, so nothing is lost while the lock
is dropped.
This hang occasionally reproduces with fstests generic/475 on a zoned
btrfs filesystem.
📍 영향받는 시스템
Zoned 파일 시스템을 사용하는 Linux 커널 기반 Btrfs 파일 시스템 환경
⚔️ 공격 벡터
로컬 시스템에서 특정 파일 시스템 작업(메타데이터 쓰기 및 트랜잭션 발생)을 유도하여 시스템 중단 유발
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 Btrfs의 잠금 해제 로직을 수정해야 합니다.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 최신 패치 버전인지 확인합니다.
📊 CVSS Vector String
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
💻 영향받는 소프트웨어
NVIDIA Cloud Gaming Guest Driver for Linux