In the Linux kernel, the following vulnerability has been resolved: s390/vfio-ap: fix KVM GISC and page leak when queue removed from host c
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
예측 데이터 없음
실측 악용 기록 없음
계획된 패치 주기 내 조치(60일 이내)
CVSS 벡터 · 메트릭
CVSS 벡터 정보 없음
상세 설명
In the Linux kernel, the following vulnerability has been resolved:
s390/vfio-ap: fix KVM GISC and page leak when queue removed from host config
Three related problems exist in the handling of KVM interrupt and page
resources when a queue is removed from the host's AP configuration
while assigned to a mediated device (mdev).
Problem 1:
1AP_RESPONSE_Q_NOT_AVAIL not handled in vfio_ap_mdev_reset_queue() 2 3When the AP bus removes a queue device whose adapter or domain has 4been removed from the host's AP configuration, 5vfio_ap_mdev_remove_queue() is called. If the queue is still in the 6host's AP configuration at that point, it calls 7vfio_ap_mdev_reset_queue(), which issues a PQAP(ZAPQ). Since the 8adapter is already gone from the host configuration, ap_zapq() returns 9AP_RESPONSE_Q_NOT_AVAIL (0x01). This response code is not handled in10vfio_ap_mdev_reset_queue()'s switch statement and falls through to11the default case, which issues a WARN but does not call12vfio_ap_free_aqic_resources(). As a result, if IRQ handling was13enabled for the queue by the guest, the KVM GISC registration and14the pinned guest page holding the notification indicator byte (NIB)15are both leaked.16 17This is fixed by adding AP_RESPONSE_Q_NOT_AVAIL to the same case as18AP_RESPONSE_DECONFIGURED and AP_RESPONSE_CHECKSTOPPED in19vfio_ap_mdev_reset_queue(). Like those response codes, Q_NOT_AVAIL20indicates the queue is not operational and no further reset attempts21are possible; the correct action is to free the IRQ resources22immediately.23 24Problem 2:AP_RESPONSE_Q_NOT_AVAIL not handled in apq_status_check()
In vfio_ap_mdev_reset_queue(), there are four cases that indicate a queue
reset has not yet completed, in which case apq_reset_check() is queued to
a work queue to verify completion of the reset operation. This function
uses the PQAP(TAPQ) function to get the queue's status and calls
apq_status_check() to verify whether the reset has completed, failed or
needs to be executed again. As described in Problem #1 above,
apq_reset_check() does not specifically check for AP_RESPONSE_Q_NOT_AVAIL,
thereby potentially leaking KVM GISC registration and the pinned guest page
holding the NIB.
This is fixed by adding a case statement for AP_RESPONSE_Q_NOT_AVAIL to
apq_status_check() and returning -ENODEV for that case. The caller,
apq_reset_check() will then check for this return code and call
vfio_ap_free_aqic_resources() to prevent the leak.
Problem 3:
1vfio_ap_free_aqic_resources() leaks saved_isc when kvm is NULL 2 3vfio_ap_free_aqic_resources() guards the call to 4kvm_s390_gisc_unregister() with: 5 6 if (q->saved_isc != VFIO_AP_ISC_INVALID && 7 !WARN_ON(!(q->matrix_mdev && q->matrix_mdev->kvm))) 8 9If matrix_mdev->kvm is NULL -- which can happen when10vfio_ap_mdev_unset_kvm() has already run and cleared kvm before a11subsequent cleanup path reaches this function -- the WARN_ON fires12and the entire block is skipped. This leaves q->saved_isc set to a13non-invalid value, creating a potential double-free on any subsequent14call to this function.15 16When kvm is NULL the KVM guest is already torn down, so17kvm_s390_gisc_unregister() need not and cannot be called; however,18q->saved_isc must always be cleared. Fix this by separating the19kvm_s390_gisc_unregister() call from the q->saved_isc reset. The20WARN_ON now guards only the genuinely impossible case of matrix_mdev21being NULL. A NULL kvm is handled gracefully by skipping only the22unregister call, and q->saved_isc = VFIO_AP_ISC_INVALID is set23unconditionally whenever saved_isc was not already invalid.24 25Additionally, add an else clause to the host-config check in26vfio_ap_mdev_remove_queue() to call vfio_ap_free_aqic_resources()27directly when the queue is not in the host's AP configuration. This28serves as a backstop: when the AP bus fires the driver .remove29callback after an adapter is removed from the host config, the queue30is by definition no longer addressable, so vfio_ap_mdev_reset_queue31---truncated---AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.
참고 자료 4
링크 내용 불러오는 중…