🇰🇷 한글 설명
Linux 커널의 dcache 코드에서 디렉터리 삭제(rmdir, unlink, rename)와 마운트 이동이 경합할 때, 삭제 중인 디렉터리에 마운트포인트가 설정될 수 있는 문제가 수정되었습니다. d_set_mounted()에서 cant_mount() 검사를 추가하여 이를 방지합니다.
💡 쉬운 설명
폴더를 지우는 동시에 다른 폴더를 그 자리에 연결하면 삭제된 폴더에 연결이 남아 정리되지 않을 수 있었습니다. 이제 삭제 중인 폴더에는 연결이 설정되지 않도록 막혔습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
dcache: don't put a mountpoint on a dentry that's being removed
rmdir(), unlink() and rename() call dont_mount() on the victim and then
detach_mounts() with the victim's inode locked. do_lock_mount() takes
the inode lock of the mountpoint and checks cant_mount() so a mount
can't show up after detach_mounts().
But attach_recursive_mnt() makes a second mountpoint for the root of the
source mount so that the mounts already located at the destination can
be put on top of it. No inode is locked for that one and d_set_mounted()
only refuses a dentry that is unlinked. Between detach_mounts() and
d_delete() the victim is still hashed:
rmrace: b passed dont_mount() and detach_mounts(), sleeping
T2: move_mount(S, /tmp/plcant/x, BENEATH) = 0 errno 0 ()
T1: rmdir(/tmp/plcant/d/b) = 0 errno 0
109 107 0:61 /d/b//deleted /tmp/plcant/x rw,relatime - tmpfs tmpfs rw
108 109 0:63 / /tmp/plcant/x rw,relatime - tmpfs T rw
A bind mount of the directory that's being removed is moved beneath an
existing mount while the rmdir() is located between the two calls. The
mount ends up on the removed directory and nothing will ever detach it.
Check cant_mount() in d_set_mounted() as well. dont_mount() raises the
flag under d_lock before detach_mounts() runs so either the mountpoint
is set first and detach_mounts() finds the mount or the flag is seen and
the mount is refused.
📍 영향받는 시스템
수정 전 Linux 커널 버전 (정확한 영향 버전 범위는 커널 패치 이력 확인 필요)
⚔️ 공격 벡터
로컬 사용자가 마운트 이동(move_mount)과 디렉터리 삭제(rmdir)를 경합 상태로 동시에 실행하여 삭제된 디렉터리에 마운트를 남김
🛡️ 대응 방법
배포판 제공 최신 Linux 커널 업데이트를 적용하고 재부팅
🔧 검증 코드
출력된 커널 버전을 배포판 보안 공지 또는 커널 패치 이력과 비교하여, 해당 수정이 포함된 버전 이상인지 확인합니다.