🇰🇷 한글 설명
Linux 커널의 ext4 파일 시스템에서 동시 xattr(확장 속성) 작업 시 ABBA 데드락(교착 상태)이 발생하는 취약점입니다. 특정 inode가 제거되는 과정과 참조를 유지하려는 작업이 서로의 자원을 기다리며 무한 대기에 빠지는 문제입니다. 이를 해결하기 위해 비차단(non-blocking) 방식의 inode 조회 플래그가 도입되었습니다.
💡 쉬운 설명
컴퓨터가 파일을 읽고 지우는 작업을 동시에 할 때, 두 작업이 서로 상대방이 끝나기만을 기다리며 멈춰버리는 현상입니다. 이로 인해 시스템이 응답하지 않거나 멈출 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ext4: fix ABBA deadlock in ext4_xattr_inode_cache_find()
Syzbot/stress-ng reported an ABBA deadlock in ext4 when exercising
concurrent xattr workloads (using the ea_inode mount/format option).
The deadlock occurs between the running transaction and the eviction
thread:
- Task 1 (stress-ng): Holds a reference to a shared mbcache_entry (ce)
and calls ext4_xattr_inode_cache_find() -> ext4_iget() to retrieve
the corresponding EA inode. Since the EA inode is currently being
evicted, ext4_iget() blocks in __wait_on_freeing_inode() waiting for
eviction to complete.
- Task 2 (eviction thread): Currently evicting the same EA inode in
ext4_evict_ea_inode(). It calls mb_cache_entry_wait_unused(oe) which
blocks waiting for Task 1 to release the reference to the mbcache_entry.
To break this deadlock, implement a new ext4_iget() configuration flag
named EXT4_IGET_NOWAIT. When set, perform a non-blocking lookup of the
inode via VFS's find_inode_nowait() API.
If the inode is currently being evicted (marked with I_FREEING or
I_WILL_FREE) or created (I_CREATING), or if it is not present in the VFS
inode cache (cache miss), simply skip it (returning -ENOENT) rather than
waiting for eviction/creation to complete, breaking the ABBA cycle.
Since we return -ENOENT immediately on a cache miss, we never attempt to
allocate a new inode or call iget_locked(), completely eliminating any
TOCTOU race window.
If the returned inode is I_NEW, wait for its initialization to clear via
wait_on_new_inode(). If initialization fails and the inode is unhashed
during wait_on_new_inode() waking up (e.g., due to an I/O read error in
another thread), safely drop the reference and return -ENOENT. This
unhashed check is executed unconditionally on all cache-hit pathways to
properly handle concurrent initialization failures.
Finally, standard validation checks (including is_bad_inode,
EXT4_EA_INODE_FL, file_acl, and xattr flags) are executed as normal inside
check_igot_inode() to fully guarantee VFS-layer safety.
In ext4_xattr_inode_cache_find(), invoke ext4_iget() with the new
EXT4_IGET_NOWAIT flag to perform the non-blocking cache search.
📍 영향받는 시스템
Linux kernel (ext4 파일 시스템을 사용하는 시스템)
⚔️ 공격 벡터
동시적인 xattr(확장 속성) 워크로드를 생성하여 시스템의 데드락 유도
🛡️ 대응 방법
ext4_iget()에 EXT4_IGET_NOWAIT 플래그를 적용하여 데드락을 해결한 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 버전인지 확인합니다.