🇰🇷 한글 설명
Linux 커널의 LoongArch 아키텍처 KVM 구현에서 memslot의 아키텍처 플래그가 제대로 보존되지 않는 취약점이 발견되었습니다. KVM_MR_FLAGS_ONLY 업데이트 시 기존의 Hugepage 관련 설정이 초기화되어, 잘못된 메모리 매핑을 통해 게스트가 호스트의 엉뚱한 페이지에 접근할 수 있는 메모리 오염 위험이 있습니다.
💡 쉬운 설명
컴퓨터 가상화 기술에서 메모리를 관리할 때 설정값이 실수로 지워지는 문제가 발생했습니다. 이로 인해 가상 컴퓨터가 실제 컴퓨터의 엉뚱한 메모리 영역을 건드릴 수 있어 보안 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
LoongArch: KVM: Preserve memslot arch flags on KVM_MR_FLAGS_ONLY
kvm_arch_prepare_memory_region() computes new->arch.flags, i.e. whether
a memslot is KVM_MEM_HUGEPAGE_CAPABLE or KVM_MEM_HUGEPAGE_INCAPABLE,
only for KVM_MR_CREATE and KVM_MR_MOVE, and returns early for every
other change. But the generic code allocates a zeroed memslot for every
change and never copies old->arch, so after a KVM_MR_FLAGS_ONLY update,
e.g. toggling KVM_MEM_LOG_DIRTY_PAGES for live migration, the active
memslot has arch.flags == 0.
With both flags clear, fault_supports_huge_mapping() falls through to
the alignment check on the HVA range alone, which no longer verifies
that the GPA and HVA have the same offset within a PMD. A memslot that
was marked KVM_MEM_HUGEPAGE_INCAPABLE because of a GPA/HVA offset
mismatch can then be mapped with PMD entries on read faults, and since
kvm_map_page() aligns the gfn and the pfn independently, the guest ends
up accessing the wrong host pages, exactly the "d -> f, e -> g" case
described in the comment above the check.
Carry the arch flags over from the old memslot for KVM_MR_FLAGS_ONLY,
as the GPA, HVA and size are guaranteed to be unchanged for that case.
📍 영향받는 시스템
LoongArch 아키텍처를 사용하는 Linux 커널 (KVM 모듈 포함)
⚔️ 공격 벡터
KVM_MR_FLAGS_ONLY 명령을 통한 memslot 플래그 업데이트 시 발생하는 메모리 매핑 오류 유도
🛡️ 대응 방법
LoongArch KVM의 memslot 업데이트 로직에서 arch.flags를 보존하도록 커널 패치 적용
🔧 검증 코드
시스템이 LoongArch 아키텍처를 사용하는지 확인하고, 최신 커널 패치 적용 여부를 커널 버전을 통해 검토하십시오.
uname -a && grep -i 'LoongArch' /proc/cpuinfo 2>/dev/null