🇰🇷 한글 설명
Linux 커널의 mm/swap_cgroup 구성 요소에서 스왑 장치가 없는(swapless) 호스트 환경 시 NULL 포인터 역참조가 발생하는 취약점입니다. PTE(Page Table Entry)가 손상되어 잘못된 스왑 엔트리로 해석될 경우, 프로세스 종료 시 커널 패닉이 발생하여 시스템이 중단될 수 있습니다.
💡 쉬운 설명
스왑 메모리를 사용하지 않는 컴퓨터에서 메모리 정보가 잘못 읽히면 시스템이 갑자기 멈추거나 꺼질 수 있는 문제입니다. 메모리 데이터의 작은 오류가 시스템 전체의 충돌로 이어질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm: swap_cgroup: fix NULL deref in lookup_swap_cgroup_id on swapless host
lookup_swap_cgroup_id() passes swap_cgroup_ctrl[type].map to
__swap_cgroup_id_lookup() without checking that the type was ever
registered via swap_cgroup_swapon(). On a swapless host every ctrl->map
is NULL, so __swap_cgroup_id_lookup() dereferences NULL + a scaled
swp_offset().
Since commit bea67dcc5eea ("mm: attempt to batch free swap entries for
zap_pte_range()"), zap_pte_range() -> swap_pte_batch() calls
lookup_swap_cgroup_id() on any non-present, non-none PTE that decodes as a
real swap entry, without first validating it against swap_info[]. A
single PTE corrupted into a type-0 swap entry takes the host down at
process exit.
We hit this in production on a swapless 6.12.58 host: ~1s of
"get_swap_device: Bad swap file entry 3f800204222bb" (do_swap_page() being
correctly defensive about the same entry) followed by
BUG: unable to handle page fault for address: 000003f800204220
RIP: 0010:lookup_swap_cgroup_id+0x2b/0x60
Call Trace:
swap_pte_batch+0xbf/0x230
zap_pte_range+0x4c8/0x780
unmap_page_range+0x190/0x3e0
exit_mmap+0xd9/0x3c0
do_exit+0x20c/0x4b0
syzbot has reported the identical stack.
The source of the PTE corruption is a separate bug; this change makes the
teardown path as robust as the fault path already is. Every other caller
of lookup_swap_cgroup_id() is downstream of a get_swap_device() that has
already validated the entry, so the new branch is cold.
📍 영향받는 시스템
Linux kernel (swapless host 환경, 특히 6.12.58 버전 포함 관련 버전)
⚔️ 공격 벡터
PTE(Page Table Entry) 손상을 유발할 수 있는 별도의 버그를 이용한 메모리 오염을 통해 시스템 중단 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 lookup_swap_cgroup_id()의 NULL 체크 로직을 적용해야 합니다.
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 패치 버전 이상인지 확인합니다.