🇰🇷 한글 설명
Linux 커널의 F2FS 파일 시스템에서 nat_entry 플래그 사용 시 상호 배제(mutual exclusion)가 결여되어 발생하는 일관성 오류입니다. 체크포인트 경로와 노드 쓰기 경로 간의 동기화 문제로 인해 inode 블록의 마킹 상태가 잘못될 수 있습니다.
💡 쉬운 설명
파일을 저장하는 과정에서 데이터의 상태를 기록하는 순서가 꼬여 파일 시스템에 오류가 생길 수 있는 문제입니다. 이로 인해 시스템이 파일의 저장 상태를 잘못 판단하여 데이터 불일치가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix fsck inconsistency caused by incorrect nat_entry flag usage
f2fs_need_dentry_mark() reads nat_entry flags without mutual exclusion
with the checkpoint path, which can result in an incorrect inode block
marking state. The scenario is as follows:
create & write & fsync 'file A' write checkpoint
- f2fs_do_sync_file // inline inode
- f2fs_write_inode // inode folio is dirty
- f2fs_write_checkpoint
- f2fs_flush_merged_writes
- f2fs_sync_node_pages
- f2fs_fsync_node_pages // no dirty node
- f2fs_need_inode_block_update // return true
- f2fs_fsync_node_pages // inode dirtied
- f2fs_need_dentry_mark //return true
- f2fs_flush_nat_entries
- f2fs_write_checkpoint end
- __write_node_folio // inode with DENT_BIT_SHIFT set
SPO, "fsck --dry-run" find inode has already checkpointed but still
with DENT_BIT_SHIFT set
The state observed by f2fs_need_dentry_mark() can differ from the state
observed in __write_node_folio() after acquiring sbi->node_write. The
root cause is that the semantics of IS_CHECKPOINTED and
HAS_FSYNCED_INODE are only guaranteed after the checkpoint write has
fully completed.
This patch moves set_dentry_mark() into __write_node_folio() and
protects it with the sbi->node_write lock.
📍 영향받는 시스템
Linux Kernel (F2FS 파일 시스템을 사용하는 시스템)
⚔️ 공격 벡터
로컬 공격자가 특정 파일 쓰기 및 fsync 작업을 정밀하게 수행하여 파일 시스템의 일관성을 깨뜨림
🛡️ 대응 방법
F2FS 관련 커널 패치를 적용하여 set_dentry_mark() 함수가 sbi->node_write 락의 보호를 받도록 업데이트해야 함
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 최신 패치 버전인지 확인합니다.