🇰🇷 한글 설명
Linux 커널의 ksmbd 모듈에서 vfs_cache 내 m_flags에 대한 레이스 컨디션 취약점이 발견되었습니다. 일부 경로에서는 잠금(lock)을 사용하지만 다른 경로에서는 사용하지 않아, 여러 스레드가 동시에 파일을 조작할 때 데이터 불일치가 발생할 수 있습니다. 이로 인해 파일 삭제 명령이 무시되거나 사용 중인 파일이 예기치 않게 삭제되는 문제가 발생할 수 있습니다.
💡 쉬운 설명
여러 작업이 동시에 같은 파일을 열거나 닫을 때, 시스템이 파일의 상태를 제대로 확인하지 못해 발생하는 오류입니다. 이 때문에 지워져야 할 파일이 남거나, 사용 중인 파일이 갑자기 사라지는 혼란이 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: vfs: fix race on m_flags in vfs_cache
ksmbd maintains delete-on-close and pending-delete state in
ksmbd_inode->m_flags. In vfs_cache.c this field is accessed under
inconsistent locking: some paths read and modify m_flags under
ci->m_lock while others do so without taking the lock at all.
Examples:
- ksmbd_query_inode_status() and __ksmbd_inode_close() use
ci->m_lock when checking or updating m_flags.
- ksmbd_inode_pending_delete(), ksmbd_set_inode_pending_delete(),
ksmbd_clear_inode_pending_delete() and ksmbd_fd_set_delete_on_close()
used to read and modify m_flags without ci->m_lock.
This creates a potential data race on m_flags when multiple threads
open, close and delete the same file concurrently. In the worst case
delete-on-close and pending-delete bits can be lost or observed in an
inconsistent state, leading to confusing delete semantics (files that
stay on disk after delete-on-close, or files that disappear while still
in use).
Fix it by:
- Making ksmbd_query_inode_status() look at m_flags under ci->m_lock
after dropping inode_hash_lock.
- Adding ci->m_lock protection to all helpers that read or modify
m_flags (ksmbd_inode_pending_delete(), ksmbd_set_inode_pending_delete(),
ksmbd_clear_inode_pending_delete(), ksmbd_fd_set_delete_on_close()).
- Keeping the existing ci->m_lock protection in __ksmbd_inode_close(),
and moving the actual unlink/xattr removal outside the lock.
This unifies the locking around m_flags and removes the data race while
preserving the existing delete-on-close behaviour.
📍 영향받는 시스템
ksmbd 모듈을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
여러 스레드를 이용해 동일한 파일에 대해 동시에 열기, 닫기, 삭제 작업을 수행하는 동시성 공격
🛡️ 대응 방법
m_flags 접근 시 ci->m_lock을 일관되게 사용하도록 수정된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인하십시오.