🇰🇷 한글 설명
Linux 커널의 inotify 기능에서 fsnotify_add_inode_mark_locked() 호출 실패 시 watch count를 감소시키지 않는 누수 취약점이 발견되었습니다. 이로 인해 반복적인 실패가 발생할 경우 실제 활성 감시 항목이 없더라도 max_user_watches 제한에 도달하여 -ENOSPC 오류가 발생할 수 있습니다.
💡 쉬운 설명
파일의 변화를 감시하는 기능에서 오류가 발생했을 때, 사용 중인 감시 횟수를 제대로 줄이지 않는 버그가 있습니다. 이 버그가 반복되면 시스템이 감시 기능을 더 이상 사용할 수 없는 상태가 될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
inotify: fix watch count leak when fsnotify_add_inode_mark_locked() fails
When fsnotify_add_inode_mark_locked() fails in inotify_new_watch(),
the error path calls inotify_remove_from_idr() but does not call
dec_inotify_watches() to undo the preceding inc_inotify_watches().
This leaks a watch count, and repeated failures can exhaust the
max_user_watches limit with -ENOSPC even when no watches are active.
Prior to commit 1cce1eea0aff ("inotify: Convert to using per-namespace
limits"), the watch count was incremented after fsnotify_add_mark_locked()
succeeded, so this path was not affected. The conversion moved
inc_inotify_watches() before the mark insertion without adding the
corresponding rollback.
Add the missing dec_inotify_watches() call in the error path.
📍 영향받는 시스템
Linux kernel (commit 1cce1eea0aff 이후 per-namespace limits 도입 버전)
⚔️ 공격 벡터
의도적으로 fsnotify_add_inode_mark_locked()를 실패하게 유도하여 watch count를 고갈시키는 로컬 공격
🛡️ 대응 방법
커널 패치를 적용하여 오류 경로에 dec_inotify_watches() 호출을 추가한 최신 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 취약점이 수정된 패치 이후의 버전인지 확인