🇰🇷 한글 설명
Linux 커널의 mm/mempolicy 구성 요소에서 HMM 기반 GPU 드라이버가 익명 THP folio를 장치 메모리로 이동시킬 때 발생하는 취약점입니다. 장치 전용 PMD를 처리하는 과정에서 잘못된 folio 포인터를 반환하여 커널 오류(Oops)나 메모리 격리 문제를 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터의 메모리를 관리하는 과정에서 GPU가 사용하는 특수 메모리 정보를 잘못 해석하여 시스템이 멈추거나 오류가 발생하는 문제입니다. 메모리 관리 규칙이 어긋나면서 컴퓨터가 엉뚱한 데이터를 참조하게 됩니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm/mempolicy: skip non-present PMDs when queueing folios
Patch series "mm: handle device-private PMDs in walk callbacks", v3.
Since commit 368076f52ebe ("mm/huge_memory: add device-private THP support
to PMD operations") a PMD may hold a device-private swap entry whenever an
HMM-based GPU driver migrates an anonymous THP folio to device memory via
migrate_vma_pages().
pmd_trans_huge_lock() succeeds for such PMDs (pmd_is_huge() returns true
for any non-present, non-none huge PMD), so several MM walk callbacks that
used to assume present THP or migration entry are now reachable with a
device-private PMD. The results range from a VM_BUG_ON() firing on debug
kernels, to an oops on a bogus vmemmap dereference, to silently isolating
an unrelated live folio from LRU in the aliasing case.
This patch (of 3):
queue_folios_pmd() is called under pmd_trans_huge_lock(), whose
pmd_is_huge() check returns true for any non-present, non-none PMD
softleaf. Passing such a PMD to pmd_folio() treats the softleaf encoding
as a hardware PFN and can return a bogus folio pointer.
Mirror queue_folios_pte_range(): handle non-present entries before looking
up a folio. Keep migration entries counted as failures, but skip other
non-present PMDs such as device-private entries.
Potential trigger: an HMM-based GPU driver migrates an anonymous THP folio
to device memory via migrate_vma_pages(), leaving a device-private PMD.
Userspace then calls mbind(), migrate_pages() or set_mempolicy_home_node()
on that range.
📍 영향받는 시스템
HMM(Heterogeneous Memory Management) 기반 GPU 드라이버를 사용하는 Linux 커널 (commit 368076f52ebe 이후 버전)
⚔️ 공격 벡터
HMM 기반 GPU 드라이버를 통해 메모리 이동이 발생한 상태에서 사용자가 mbind(), migrate_pages() 등의 시스템 호출을 실행하여 트리거
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전(mm: handle device-private PMDs in walk callbacks 패치 포함)으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 시리즈(v3)가 적용된 버전인지 확인