🇰🇷 한글 설명
Linux 커널의 mm/shrinker 구성 요소에서 cgroup.memory=nokmem 설정 시 발생하는 취약점입니다. 메모리 제어 그룹(memcg)의 ID가 올바르게 할당되지 않아 유효하지 않은 인덱스가 사용되며, 이로 인해 커널 경고(WARNING)가 발생할 수 있습니다.
💡 쉬운 설명
리눅스 시스템의 메모리 관리 설정 중 특정 옵션을 사용할 때, 시스템이 메모리를 정리하는 과정에서 잘못된 번호를 참조하여 오류 경고를 발생시키는 문제입니다. 다행히 시스템이 즉시 멈추는 치명적인 오류는 아니지만, 내부적인 데이터 불일치가 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm/shrinker: fix bogus set_shrinker_bit() with cgroup.memory=nokmem
With cgroup.memory=nokmem, shrinker_memcg_alloc() bails out early and
never allocates an id, so shrinker->id keeps the 0 it got from the
kzalloc() in shrinker_alloc(). __list_lru_init() then copies that 0 into
lru->shrinker_id, where it looks like a valid bit index.
Nothing calls expand_shrinker_info() on nokmem either, so shrinker_nr_max
stays 0 and every memcg ends up with an empty map (map_nr_max == 0).
deferred_split_folio() hands a real memcg to __list_lru_add() regardless
of whether the lru is memcg aware, so the first THP queued in a cgroup
does set_shrinker_bit(memcg, nid, 0) and trips the bounds check:
WARNING: mm/shrinker.c:212 at set_shrinker_bit+0x7d/0x90, CPU#126
Call Trace:
<TASK>
deferred_split_folio+0x18c/0x220
map_anon_folio_pmd_nopf+0xdd/0x130
map_anon_folio_pmd_pf+0x14/0xb0
do_huge_pmd_anonymous_page+0x1a1/0x620
__handle_mm_fault+0xea9/0x10d0
handle_mm_fault+0xe5/0x320
do_user_addr_fault+0x1cc/0x870
exc_page_fault+0x81/0x1b0
asm_exc_page_fault+0x27/0x30
</TASK>
Harmless, the WARN_ON_ONCE() is what keeps the out of bounds unit[] read
from happening, but the id should not look valid in the first place.
Clear it before returning.
Two other spots could paper over this: drop the id in __list_lru_init()
when nokmem turns memcg_aware off, or make deferred_split_folio() pass
NULL like list_lru_add_obj() does. Both leave shrinker->id lying around
for the next caller, so fix it where the id is handed out.
📍 영향받는 시스템
cgroup.memory=nokmem 옵션을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
로컬 시스템에서 특정 메모리 관리 옵션(nokmem)을 활성화하여 커널 경고를 유도하는 방식
🛡️ 대응 방법
해당 취약점이 수정된 최신 Linux 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 패치 버전인지 배포판 보안 공지를 통해 확인하십시오.
💻 영향받는 소프트웨어
NVIDIA Cloud Gaming Guest Driver for Linux