🇰🇷 한글 설명
Linux 커널의 hugetlb cgroup 구현에서 예약(rsvd) 및 비예약(non-rsvd) 충전 시 동일한 h_cg 포인터를 사용하여 발생하는 불일치 취약점입니다. 이로 인해 잘못된 cgroup 포인터가 저장되어 페이지 카운터 언더플로우(underflow)가 발생할 수 있습니다.
💡 쉬운 설명
메모리를 관리하는 과정에서 장부 기록이 잘못되어, 실제 사용하지 않은 메모리 수치를 마이너스로 계산해버리는 오류입니다. 이로 인해 시스템의 메모리 관리 체계가 엉키거나 불안정해질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm/hugetlb: fix hugetlb cgroup rsvd charge/uncharge mismatch
In alloc_hugetlb_folio(), a single h_cg pointer is used for both the rsvd
and non-rsvd hugetlb cgroup charges. When map_chg is set,
hugetlb_cgroup_charge_cgroup_rsvd() stores the charged cgroup in h_cg, but
the immediately following hugetlb_cgroup_charge_cgroup() overwrites h_cg
with the non-rsvd cgroup pointer.
As a result, hugetlb_cgroup_commit_charge_rsvd() stores the wrong
(non-rsvd) cgroup pointer into the folio's rsvd slot.
When the folio is later freed, free_huge_folio() unconditionally calls
both hugetlb_cgroup_uncharge_folio() and
hugetlb_cgroup_uncharge_folio_rsvd(). The rsvd uncharge reads back the
wrong cgroup from the folio and decrements a counter that was never
charged for that cgroup, causing a page_counter underflow:
page_counter underflow: -512 nr_pages=512
WARNING: mm/page_counter.c:61 at page_counter_cancel
Fix this by introducing a separate h_cg_rsvd pointer exclusively for the
rsvd charge path, keeping the rsvd and non-rsvd charges fully independent
through their charge, commit, and error uncharge paths.
📍 영향받는 시스템
Linux Kernel (hugetlb cgroup 관련 모듈 사용 시스템)
⚔️ 공격 벡터
로컬 사용자가 hugetlb cgroup 리소스를 조작하여 페이지 카운터 언더플로우 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 h_cg_rsvd 포인터 분리 로직 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인