🇰🇷 한글 설명
Linux 커널 XFS 파일시스템에서 reflink(공유 블록) 플래그 처리 결함이 수정되었습니다. 파괴적 교환(exchange) 작업 시 EOF 이후에 공유 블록을 가진 파일의 reflink 플래그가 잘못 제거되어, 이후 쓰기가 CoW 없이 제자리에서 수행되며 공유 파일 데이터가 손상될 수 있었습니다.
💡 쉬운 설명
같은 데이터를 여러 파일이 공유하는 상황에서 파일 시스템이 공유 표시를 잘못 지워, 한 파일을 수정하면 다른 파일의 내용도 함께 망가질 수 있었습니다. 이 문제는 커널 패치로 해결되었습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
xfs: stop exchanging reflink flags when exchanging mappings
When an exchange covers both files from offset 0 to i_disk_size,
xmi_can_exchange_reflink_flags() assumes every mapping moved and hands
the reflink flag over to the other file.
That assumption is wrong. A file can still own shared blocks past
i_disk_size, e.g. after EXCHANGE_RANGE_TO_EOF sets a smaller size
without unmapping anything. The flag is cleared anyway, and the next
write to such a block happens in place instead of CoW, corrupting the
other file that shares it.
Commit a23eca88448e ("xfs: fix exchange-range reflink flag clearing
issue with INO1_WRITTEN") fixed one instance of this. Rather than add
another special case, stop moving the flags.
xfs_exchmaps_ensure_reflink() already sets the flag on both inodes
before the exchange, so both just keep it.
Nothing sets CLEAR_INO{1,2}_REFLINK anymore. Intents logged by older
kernels may still carry them; recovery already masks them off, so they
stay in the log format mask and are ignored.
XFS_IOC_SWAPEXT has the same problem: it moves the reflink flag from
one inode to the other along with the extents. Just removing that is
not enough here: the exchange path flags both inodes up front in
xfs_exchmaps_ensure_reflink(), but swapext has no such step, so the
inode receiving the shared extents would be left without the flag.
Set it on both inodes instead, and make sure both have a CoW fork,
since an inode with the reflink flag is expected to have one.
The flag now stays until FALLOC_FL_UNSHARE_RANGE, xfs_scrub, or a
truncate to zero removes it.
📍 영향받는 시스템
XFS 파일시스템을 사용하는 Linux 커널(패치 적용 전 버전)
⚔️ 공격 벡터
로컬 사용자가 파일 교환(EXCHANGE_RANGE/SWAPEXT) 작업을 통해 공유 블록을 가진 파일의 reflink 플래그를 잘못 제거하여 다른 파일의 데이터를 손상시킬 수 있음
🛡️ 대응 방법
배포판에서 제공하는 최신 Linux 커널 보안 업데이트를 설치하고 재부팅하세요.
🔧 검증 코드
출력된 커널 버전을 배포판 보안 공지에서 이 수정이 포함된 빌드와 비교하여, 같거나 이후 버전이면 패치가 적용된 것입니다.