🇰🇷 한글 설명
Linux 커널의 KVM PPC Book3S HV 구현에서 kvmhv_emulate_tlbie_all_lpid() 함수가 IDR에서 가져온 kvm_nested_guest 포인터에 대한 참조를 유지하지 않아 Use-After-Free 취약점이 발생합니다. mmu_lock을 해제하는 동안 다른 vCPU가 해당 중첩 게스트를 제거하면, 반복문을 실행 중인 vCPU가 해제된 메모리에 접근하게 되어 시스템 불안정성이나 권한 상승을 초래할 수 있습니다.
💡 쉬운 설명
컴퓨터의 가상화 기능을 관리하는 프로그램에서 메모리 사용 순서가 잘못되어 발생하는 오류입니다. 특정 작업 중에 메모리가 갑자기 삭제되어, 시스템이 엉뚱한 곳을 참조하다가 멈추거나 해킹될 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
KVM: PPC: Book3S HV: fix use-after-free in kvmhv_emulate_tlbie_all_lpid()
kvmhv_emulate_tlbie_all_lpid() iterates the nested-guest IDR and drops
mmu_lock before calling kvmhv_emulate_tlbie_lpid(), but does not hold a
reference on the kvm_nested_guest pointer obtained from the IDR. A
concurrent vCPU issuing a single-LPID tlbie (is=2, ric=2) can race
through kvmhv_flush_nested() -> kvmhv_remove_nested() -> idr_remove /
--refcnt -> kvmhv_release_nested() -> kfree(gp) in that window, leaving
the iterating vCPU with a dangling pointer. The subsequent
mutex_lock(&gp->tlb_lock) and accesses to gp->shadow_pgtable,
gp->shadow_lpid and gp->l1_host all touch freed memory. The free path
is fully L1-controlled.
Fix this by incrementing gp->refcnt inside the loop before dropping
mmu_lock, mirroring what kvmhv_get_nested() does, and releasing the
reference with kvmhv_put_nested() after the per-guest work completes.
This is the same get/put discipline already used at every other
call site that drops mmu_lock while holding a nested-guest pointer.
📍 영향받는 시스템
Linux Kernel (KVM PPC Book3S HV 환경)
⚔️ 공격 벡터
L1 제어 하에 있는 vCPU가 특정 TLBIE 명령을 실행하여 메모리 해제와 참조 사이의 레이스 컨디션을 유도함
🛡️ 대응 방법
커널 패치를 적용하여 IDR에서 포인터를 가져올 때 참조 횟수(refcnt)를 증가시키고 작업 완료 후 해제하도록 수정
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 수정된 최신 패치 버전인지 확인합니다.