🇰🇷 한글 설명
Linux 커널의 fsnotify 구성 요소에서 inode 참조 누수가 발생하는 취약점입니다. fsnotify_recalc_mask() 함수가 __fsnotify_recalc_mask()의 반환값을 적절히 처리하지 못해, 특정 조건에서 inode가 해제되지 않고 남아 시스템 작업이 중단되는 현상이 발생합니다.
💡 쉬운 설명
컴퓨터가 파일 정보를 관리하는 과정에서 사용이 끝난 정보를 제대로 지우지 못해 발생하는 문제입니다. 이로 인해 시스템이 특정 작업을 수행하다가 멈춰버리는 현상이 나타날 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
fsnotify: fix inode reference leak in fsnotify_recalc_mask()
fsnotify_recalc_mask() fails to handle the return value of
__fsnotify_recalc_mask(), which may return an inode pointer that needs
to be released via fsnotify_drop_object() when the connector's HAS_IREF
flag transitions from set to cleared.
This manifests as a hung task with the following call trace:
INFO: task umount:1234 blocked for more than 120 seconds.
Call Trace:
__schedule
schedule
fsnotify_sb_delete
generic_shutdown_super
kill_anon_super
cleanup_mnt
task_work_run
do_exit
do_group_exit
The race window that triggers the iref leak:
Thread A (adding mark) Thread B (removing mark)
────────────────────── ────────────────────────
fsnotify_add_mark_locked():
fsnotify_add_mark_list():
spin_lock(conn->lock)
add mark_B(evictable) to list
spin_unlock(conn->lock)
return
/* ---- gap: no lock held ---- */
fsnotify_detach_mark(mark_A):
spin_lock(mark_A->lock)
clear ATTACHED flag on mark_A
spin_unlock(mark_A->lock)
fsnotify_put_mark(mark_A)
fsnotify_recalc_mask():
spin_lock(conn->lock)
__fsnotify_recalc_mask():
/* mark_A skipped: ATTACHED cleared */
/* only mark_B(evictable) remains */
want_iref = false
has_iref = true /* not yet cleared */
-> HAS_IREF transitions true -> false
-> returns inode pointer
spin_unlock(conn->lock)
/* BUG: return value discarded!
* iput() and fsnotify_put_sb_watched_objects()
* are never called */
Fix this by deferring the transition true -> false of HAS_IREF flag from
fsnotify_recalc_mask() (Thread A) to fsnotify_put_mark() (thread B).
📍 영향받는 시스템
Linux Kernel (fsnotify 관련 모듈이 포함된 버전)
⚔️ 공격 벡터
로컬 사용자가 특정 파일 시스템 이벤트 모니터링 작업을 반복하여 리소스 누수를 유도할 수 있음
🛡️ 대응 방법
해당 취약점이 수정된 최신 Linux 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 패치 버전인지 배포판 보안 공지를 통해 확인