🇰🇷 한글 설명
Linux 커널의 dm-cache 드라이버에서, 매핑 오류로 실패한 캐시 장치의 resume 작업을 재시도하면 불완전하게 초기화된 정책 객체에 캐시 매핑을 로드하는 과정에서 BUG_ON이 발생할 수 있습니다. 이 수정은 초기 시도가 실패한 장치에 대한 resume 작업을 허용하지 않도록 차단합니다.
💡 쉬운 설명
디스크 캐시 장치가 일부 손상된 상태에서 다시 시작을 반복하면 커널이 강제로 멈출 수 있습니다. 이번 패치는 실패한 장치를 반복해서 시작하지 못하도록 막아 이 문제를 방지합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
dm cache: prevent BUG_ON by blocking retries on failed device resumes
A cache device failing to resume due to mapping errors should not be
retried, as the failure leaves a partially initialized policy object.
Repeating the resume operation risks triggering BUG_ON when reloading
cache mappings into the incomplete policy object.
Reproduce steps:
1. create a cache metadata consisting of 512 or more cache blocks,
with some mappings stored in the first array block of the mapping
array. Here we use cache_restore v1.0 to build the metadata.
cat <<EOF >> cmeta.xml
<superblock uuid="" block_size="128" nr_cache_blocks="512" \
policy="smq" hint_width="4">
<mappings>
<mapping cache_block="0" origin_block="0" dirty="false"/>
</mappings>
</superblock>
EOF
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0"
cache_restore -i cmeta.xml -o /dev/mapper/cmeta --metadata-version=2
dmsetup remove cmeta
2. wipe the second array block of the mapping array to simulate
data degradations.
mapping_root=$(dd if=/dev/sdc bs=1c count=8 skip=192 \
2>/dev/null | hexdump -e '1/8 "%u\n"')
ablock=$(dd if=/dev/sdc bs=1c count=8 skip=$((4096*mapping_root+2056)) \
2>/dev/null | hexdump -e '1/8 "%u\n"')
dd if=/dev/zero of=/dev/sdc bs=4k count=1 seek=$ablock
3. try bringing up the cache device. The resume is expected to fail
due to the broken array block.
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0"
dmsetup create cdata --table "0 65536 linear /dev/sdc 8192"
dmsetup create corig --table "0 524288 linear /dev/sdc 262144"
dmsetup create cache --notable
dmsetup load cache --table "0 524288 cache /dev/mapper/cmeta \
/dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0"
dmsetup resume cache
4. try resuming the cache again. An unexpected BUG_ON is triggered
while loading cache mappings.
dmsetup resume cache
Kernel logs:
(snip)
------------[ cut here ]------------
kernel BUG at drivers/md/dm-cache-policy-smq.c:752!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
CPU: 0 UID: 0 PID: 332 Comm: dmsetup Not tainted 6.13.4 #3
RIP: 0010:smq_load_mapping+0x3e5/0x570
Fix by disallowing resume operations for devices that failed the
initial attempt.
📍 영향받는 시스템
Linux 커널 dm-cache(device-mapper 캐시) 기능을 사용하는 시스템, 수정 커밋 이전 버전의 6.x 계열 커널 등
⚔️ 공격 벡터
로컬 권한을 가진 사용자가 손상된 캐시 메타데이터를 구성하고 resume을 반복 실행하여 커널 패닉(서비스 거부)을 유발
🛡️ 대응 방법
배포판에서 제공하는 CVE-2025-38066 수정이 포함된 최신 커널로 업데이트하고 재부팅
🔧 검증 코드
커널 버전이 수정 포함 패치 버전 이상인지 확인하고, dm-cache 모듈이 로드되지 않았다면 해당 기능이 사용되지 않아 위험이 낮음을 의미합니다.
uname -r; ls /sys/module/dm_cache 2>/dev/null && echo dm-cache-loaded || echo dm-cache-not-loaded