🇰🇷 한글 설명
Linux 커널의 Btrfs 파일 시스템에서 btrfs_drop_extent_map_range 함수가 범위를 분할할 때 계산 오류가 발생하는 취약점입니다. 이 오류로 인해 잘못된 extent_map이 생성되어 다른 데이터 항목과 겹치거나 블록 계산에 문제를 일으킬 수 있습니다.
💡 쉬운 설명
파일 시스템이 데이터를 관리하는 과정에서 계산 실수로 인해 데이터의 위치를 잘못 지정하는 버그입니다. 이로 인해 데이터가 엉키거나 시스템에 경고가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix incorrect splitting in btrfs_drop_extent_map_range
In production we were seeing a variety of WARN_ON()'s in the extent_map
code, specifically in btrfs_drop_extent_map_range() when we have to call
add_extent_mapping() for our second split.
Consider the following extent map layout
PINNED
[0 16K) [32K, 48K)
and then we call btrfs_drop_extent_map_range for [0, 36K), with
skip_pinned == true. The initial loop will have
start = 0
end = 36K
len = 36K
we will find the [0, 16k) extent, but since we are pinned we will skip
it, which has this code
start = em_end;
if (end != (u64)-1)
len = start + len - em_end;
em_end here is 16K, so now the values are
start = 16K
len = 16K + 36K - 16K = 36K
len should instead be 20K. This is a problem when we find the next
extent at [32K, 48K), we need to split this extent to leave [36K, 48k),
however the code for the split looks like this
split->start = start + len;
split->len = em_end - (start + len);
In this case we have
em_end = 48K
split->start = 16K + 36K // this should be 16K + 20K
split->len = 48K - (16K + 36K) // this overflows as 16K + 36K is 52K
and now we have an invalid extent_map in the tree that potentially
overlaps other entries in the extent map. Even in the non-overlapping
case we will have split->start set improperly, which will cause problems
with any block related calculations.
We don't actually need len in this loop, we can simply use end as our
end point, and only adjust start up when we find a pinned extent we need
to skip.
Adjust the logic to do this, which keeps us from inserting an invalid
extent map.
We only skip_pinned in the relocation case, so this is relatively rare,
except in the case where you are running relocation a lot, which can
happen with auto relocation on.
📍 영향받는 시스템
Btrfs 파일 시스템을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
로컬 공격자가 특정 파일 시스템 조작을 통해 잘못된 데이터 매핑을 유도할 수 있음
🛡️ 대응 방법
Btrfs 관련 수정 사항이 포함된 최신 Linux 커널로 업데이트
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 취약점이 해결된 최신 버전인지 확인합니다.