🇰🇷 한글 설명
리눅스 커널의 libfs에서 디렉토리 오프셋 할당자가 순환할 때 기존 디렉토리 항목이 readdir/getdents를 통해 보이지 않게 되는 취약점입니다. 32비트 플랫폼에서는 오프셋 값이 비교적 빠르게 최대치에 도달하여 다시 낮은 값으로 돌아가는데, 이때 특정 조건문이 기존 항목들을 누락시키는 문제를 발생시킵니다.
💡 쉬운 설명
컴퓨터가 폴더 안의 파일 목록을 불러올 때, 번호표가 다시 낮은 숫자로 돌아가면 기존 파일들을 찾지 못하고 사라진 것처럼 보이는 현상입니다. 특히 32비트 시스템에서 이 문제가 더 빨리 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Revert "libfs: fix infinite directory reads for offset dir"
The current directory offset allocator (based on mtree_alloc_cyclic)
stores the next offset value to return in octx->next_offset. This
mechanism typically returns values that increase monotonically over
time. Eventually, though, the newly allocated offset value wraps
back to a low number (say, 2) which is smaller than other already-
allocated offset values.
Yu Kuai <
[email protected]> reports that, after commit 64a7ce76fb90
("libfs: fix infinite directory reads for offset dir"), if a
directory's offset allocator wraps, existing entries are no longer
visible via readdir/getdents because offset_readdir() stops listing
entries once an entry's offset is larger than octx->next_offset.
These entries vanish persistently -- they can be looked up, but will
never again appear in readdir(3) output.
The reason for this is that the commit treats directory offsets as
monotonically increasing integer values rather than opaque cookies,
and introduces this comparison:
if (dentry2offset(dentry) >= last_index) {
On 64-bit platforms, the directory offset value upper bound is
2^63 - 1. Directory offsets will monotonically increase for millions
of years without wrapping.
On 32-bit platforms, however, LONG_MAX is 2^31 - 1. The allocator
can wrap after only a few weeks (at worst).
Revert commit 64a7ce76fb90 ("libfs: fix infinite directory reads for
offset dir") to prepare for a fix that can work properly on 32-bit
systems and might apply to recent LTS kernels where shmem employs
the simple_offset mechanism.
📍 영향받는 시스템
32-bit Linux kernel systems using libfs with mtree_alloc_cyclic (specifically after commit 64a7ce76fb90)
⚔️ 공격 벡터
직접적인 공격보다는 시스템 운영 중 오프셋 순환에 의해 데이터 가시성이 상실되는 서비스 거부(DoS) 형태의 논리적 오류입니다.
🛡️ 대응 방법
해당 취약점이 해결된 최신 리눅스 커널 버전으로 업데이트하거나, 문제가 된 커밋이 되돌려진(revert) 패치가 적용된 커널을 사용해야 합니다.
🔧 검증 코드
현재 커널 버전과 커널 로그를 확인하여 취약한 커밋이 포함된 버전인지 확인합니다.
uname -a && dmesg | grep -i 'libfs'