🇰🇷 한글 설명
Linux 커널의 KVM 환경에서 Intel PEBS 기능 설정 시 vCPU의 의도된 값을 제대로 마스킹하지 않아 발생하는 취약점입니다. 이로 인해 게스트 OS가 PEBS를 사용하지 않으려 해도 강제로 활성화되어, 페이지 폴트(#PF)가 무한히 발생하며 게스트 시스템이 충돌할 수 있습니다.
💡 쉬운 설명
가상 머신을 사용할 때 특정 성능 측정 기능이 원치 않게 켜지면서 가상 머신이 갑자기 멈추거나 꺼지는 현상이 발생할 수 있습니다. 이는 시스템 전체의 보안 위협보다는 가상 머신의 안정성을 해치는 문제입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
perf/x86/intel: KVM: Mask PEBS_ENABLE loaded for guest with vCPU's value.
When generating the MSR_IA32_PEBS_ENABLE value that will be loaded on
VM-Entry to a KVM guest, mask the value with the vCPU's desired PEBS_ENABLE
value. Consulting only the host kernel's host vs. guest masks results in
running the guest with PEBS enabled even when the guest doesn't want to use
PEBS. Because KVM uses perf events to proxy the guest virtual PMU, simply
looking at exclude_host can't differentiate between events created by host
userspace, and events created by KVM on behalf of the guest.
Running the guest with PEBS unexpectedly enabled typically manifests as
crashes due to a near-infinite stream of #PFs. E.g. if the guest hasn't
written MSR_IA32_DS_AREA, the CPU will hit page faults on address '0' when
trying to record PEBS events.
The issue is most easily reproduced by running `perf kvm top` from before
commit 7b100989b4f6 ("perf evlist: Remove __evlist__add_default") (after
which, `perf kvm top` effectively stopped using PEBS). The userspace side
of perf creates a guest-only PEBS event, which intel_guest_get_msrs()
misconstrues a guest-*owned* PEBS event.
Arguably, this is a userspace bug, as enabling PEBS on guest-only events
simply cannot work, and userspace can kill VMs in many other ways (there
is no danger to the host). However, even if this is considered to be bad
userspace behavior, there's zero downside to perf/KVM restricting PEBS to
guest-owned events.
Note, commit 854250329c02 ("KVM: x86/pmu: Disable guest PEBS temporarily
in two rare situations") fixed the case where host userspace is profiling
KVM *and* userspace, but missed the case where userspace is profiling only
KVM.
📍 영향받는 시스템
Intel CPU를 사용하는 Linux 커널 기반 KVM 환경 (특정 커밋 7b100989b4f6 이전 버전)
⚔️ 공격 벡터
사용자 공간(userspace)에서 `perf kvm top`과 같은 도구를 사용하여 게스트 전용 PEBS 이벤트를 생성함으로써 유도 가능
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 PEBS 마스킹 로직을 수정해야 함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 이후의 버전인지 확인하십시오.