🇰🇷 한글 설명
Linux 커널의 mm/hugetlb 구성 요소에서 fork() 호출 시 uffd-wp 비트를 해제하는 과정 중 스왑 엔트리가 손상되는 취약점이 발견되었습니다. x86-64 아키텍처에서 hugetlb 페이지 마이그레이션 또는 hwpoison 엔트리의 PFN(Page Frame Number) 값이 잘못 계산되어 데이터 무결성이 깨질 수 있습니다.
💡 쉬운 설명
리눅스 운영체제가 메모리를 복사하는 과정에서 특정 메모리 주소 값을 잘못 계산하여 데이터가 엉뚱한 곳을 가리키게 만드는 오류입니다. 이로 인해 시스템의 메모리 정보가 오염될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm/hugetlb: fix swap entry corruption when clearing uffd-wp at fork()
copy_hugetlb_page_range() clears the uffd-wp bit of migration and hwpoison
entries with huge_pte_clear_uffd_wp(), which operates on the present-PTE
bit position. Swap entries keep the uffd-wp state elsewhere -- the
migration branch reads and sets it with pte_swp_uffd_wp() and
pte_swp_mkuffd_wp() -- and the present-PTE position falls into the swap
payload. On x86-64 it lands in the inverted swap offset, where a
naturally-aligned hugetlb PFN always has the affected bit set, so the
clear advances the encoded PFN by two pages.
No userfaultfd needs to be involved: the clear is guarded only by the
child VMA not being uffd-wp registered, so a plain fork() with an
in-flight hugetlb migration entry (or a poisoned hugetlb page) corrupts
the entry copied into the child. Instrumenting the clear and forking
after MADV_HWPOISON on a 2MB anon hugetlb page shows:
offset before=120e00
offset after =120e02
The fallout is mostly latent: rmap walks match migration entries by folio
range and remove_migration_pte() rebuilds the PTE from the folio, so a
within-folio PFN skew heals once migration completes. But any path that
re-encodes the corrupted offset -- e.g. hugetlb_change_protection()
rewriting a writable migration entry via
make_readable_migration_entry(swp_offset(entry)) -- propagates it.
Migration entries legitimately carry uffd-wp, so clear it with
pte_swp_clear_uffd_wp(), matching copy_nonpresent_pte() and
move_huge_pte().
A hwpoison entry, on the other hand, never carries the uffd-wp bit: it is
installed fresh by make_hwpoison_entry() (try_to_unmap_one() does not
preserve uffd-wp on the hwpoison path) and hugetlb_change_protection()
leaves hwpoison entries untouched. There was nothing to clear there, only
the corruption, so drop the clear entirely.
📍 영향받는 시스템
Linux Kernel (hugetlb 관련 기능이 활성화된 시스템)
⚔️ 공격 벡터
로컬 공격자가 fork()를 호출하여 마이그레이션 중인 hugetlb 페이지를 복제함으로써 메모리 엔트리 오염 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 pte_swp_clear_uffd_wp() 적용 및 불필요한 비트 해제 로직 제거
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인하십시오.