🇰🇷 한글 설명
Linux 커널의 MGLRU(Multi-Gen LRU) 메커니즘에서 메모리 제어 그룹(memcg)의 부모 재지정 과정 중 stale 배치 업데이트가 발생하는 취약점입니다. 이로 인해 페이지 수가 실제보다 적게 계산되어 시스템이 불필요하게 메모리 부족(OOM) 상태에 빠질 수 있습니다.
💡 쉬운 설명
메모리를 관리하는 시스템이 메모리 사용량을 계산할 때 오류를 일으켜, 실제로는 메모리가 남아있음에도 불구하고 시스템이 메모리가 부족하다고 착각하여 프로그램을 강제로 종료할 수 있는 문제입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm: mglru: fix stale batch updates after memcg reparenting
The mglru page table walker batches per-generation size deltas in
walk->nr_pages while walking page tables without holding the lruvec lock.
The reset_batch_size() later folds those deltas into walk->lruvec under
the lruvec lock.
The page table walker can run concurrently with the memcg reparenting path
as follows:
CPU0 CPU1
==== ====
walk_mm
--> walk_page_range
--> update_batch_size
--> walk->nr_pages += delta
mem_cgroup_css_offline
--> memcg_reparent_objcgs
--> lock lruvec
lru_gen_reparent_memcg
--> reparent child folios to parent
unlock lruvec
lock lruvec
reset_batch_size
--> child lrugen->nr_pages += delta
This will trigger the following warning in lru_gen_exit_memcg():
VM_WARN_ON_ONCE(memchr_inv(lruvec->lrugen.nr_pages, 0,
sizeof(lruvec->lrugen.nr_pages)));
And the user-visible impact of underestimated nr_pages in MGLRU was
premature OOMs because MGLRU does not try to reclaim memory when nr_pages
reaches zero, but there are still more pages.
To fix it, make reset_batch_size() check CSS_DYING under RCU before
flushing the pending batch. A non-dying memcg keeps the original lruvec
stable against RCU-delayed offlining; a dying memcg redirects the deltas
to the first non-dying ancestor.
📍 영향받는 시스템
MGLRU 기능이 활성화된 Linux 커널 버전
⚔️ 공격 벡터
직접적인 공격보다는 메모리 관리 로직의 경합 조건(Race Condition)을 이용한 시스템 가용성 저하 유발
🛡️ 대응 방법
MGLRU 관련 패치가 적용된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전인지 확인