🇰🇷 한글 설명
Linux 커널의 dm-cache에서 passthrough 모드 전환 시 dirty mapping 확인 로직에 결함이 발견되었습니다. LVM의 테이블 프리로드 기능이 사용될 경우, 메타데이터 업데이트 중에 잘못된 체크가 수행되어 dirty mapping이 passthrough 모드로 로드될 수 있으며, 이는 데이터 손실을 초래할 수 있습니다.
💡 쉬운 설명
데이터를 임시로 저장하는 캐시 기능을 사용할 때, 시스템 설정이 바뀌는 과정에서 저장되지 않은 데이터가 무시될 수 있는 문제입니다. 이로 인해 중요한 파일이 깨지거나 데이터가 사라질 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
dm cache: fix dirty mapping checking in passthrough mode switching
As mentioned in commit 9b1cc9f251af ("dm cache: share cache-metadata
object across inactive and active DM tables"), dm-cache assumed table
reload occurs after suspension, while LVM's table preload breaks this
assumption. The dirty mapping check for passthrough mode was designed
around this assumption and is performed during table creation, causing
the check to fail with preload while metadata updates are ongoing. This
risks loading dirty mappings into passthrough mode, resulting in data
loss.
Reproduce steps:
1. Create a writeback cache with zero migration_threshold to produce
dirty mappings
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0"
dmsetup create cdata --table "0 131072 linear /dev/sdc 8192"
dmsetup create corig --table "0 262144 linear /dev/sdc 262144"
dd if=/dev/zero of=/dev/mapper/cmeta bs=4k count=1 oflag=direct
dmsetup create cache --table "0 262144 cache /dev/mapper/cmeta \
/dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writeback smq \
2 migration_threshold 0"
2. Preload a table in passthrough mode
dmsetup reload cache --table "0 262144 cache /dev/mapper/cmeta \
/dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 passthrough smq 0"
3. Write to the first cache block to make it dirty
fio --filename=/dev/mapper/cache --name=populate --rw=write --bs=4k \
--direct=1 --size=64k
4. Resume the inactive table. Now it's possible to load the dirty block
into passthrough mode.
dmsetup resume cache
Fix by moving the checks to the preresume phase to support table
preloading. Also remove the unused function dm_cache_metadata_all_clean.
📍 영향받는 시스템
Linux Kernel (dm-cache를 사용하는 시스템)
⚔️ 공격 벡터
로컬 시스템에서 LVM 테이블 프리로드를 유도하여 데이터 무결성을 파괴하는 방식
🛡️ 대응 방법
dm-cache의 dirty mapping 체크 로직을 preresume 단계로 이동시킨 최신 커널로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인하십시오.