🇰🇷 한글 설명
Linux 커널의 eventfs에서 remount 작업 시 eventfs_mutex와 SRCU를 적절히 유지하지 않아 발생하는 취약점입니다. 이로 인해 리스트 순회 중 데이터가 삭제되거나 메모리가 해제되어 LIST_POISON1 역참조 및 시스템 충돌이 발생할 수 있습니다.
💡 쉬운 설명
시스템의 설정 정보를 다시 불러오는 과정에서 데이터가 동시에 수정되거나 삭제되어 컴퓨터가 갑자기 멈추거나 오류가 발생할 수 있는 문제입니다. 데이터가 안전하게 보호되지 않은 상태에서 작업을 수행하기 때문에 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
eventfs: Hold eventfs_mutex and SRCU when remount walks events
Commit 340f0c7067a9 ("eventfs: Update all the eventfs_inodes from the
events descriptor") had eventfs_set_attrs() recurse through ei->children
on remount. The walk only holds the rcu_read_lock() taken by
tracefs_apply_options() over tracefs_inodes, which is wrong:
- list_for_each_entry over ei->children races with the list_del_rcu()
in eventfs_remove_rec() -- LIST_POISON1 deref, same shape as
d2603279c7d6.
- eventfs_inodes are freed via call_srcu(&eventfs_srcu, ...).
rcu_read_lock() does not extend an SRCU grace period, so ti->private
can be reclaimed under the walk.
- The writes to ei->attr race with eventfs_set_attr(), which holds
eventfs_mutex.
Reproducer:
while :; do mount -o remount,uid=$((RANDOM%1000)) /sys/kernel/tracing; done &
while :; do
echo "p:kp submit_bio" > /sys/kernel/tracing/kprobe_events
echo > /sys/kernel/tracing/kprobe_events
done
Wrap the events portion of tracefs_apply_options() in
eventfs_remount_lock()/_unlock() that take eventfs_mutex and
srcu_read_lock(&eventfs_srcu). eventfs_set_attrs() doesn't sleep so the
nested rcu_read_lock() is fine; lockdep_assert_held() pins the contract.
Comment in tracefs_drop_inode() said "RCU cycle" -- it is SRCU.
📍 영향받는 시스템
Linux Kernel (eventfs/tracefs 관련 모듈 사용 버전)
⚔️ 공격 벡터
로컬 사용자가 /sys/kernel/tracing 파일 시스템을 반복적으로 remount하여 레이스 컨디션(Race Condition) 유도
🛡️ 대응 방법
커널 패치(Commit 340f0c7067a9)를 적용하여 eventfs_remount_lock 및 srcu_read_lock을 사용하도록 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 패치가 적용된 최신 보안 업데이트 버전인지 확인