🇰🇷 한글 설명
Linux 커널의 PCI/MSI 구현 중 MSI-X 오류 처리 과정에서 중복된 iounmap 호출로 인해 발생하는 취약점입니다. 이전 패치에서 추가된 unmap 로직이 이미 수행된 자원 해제 작업을 다시 시도하여 NULL 포인터 참조를 유발합니다.
💡 쉬운 설명
컴퓨터 부품이 오류를 일으켰을 때, 이미 정리된 메모리 주소를 한 번 더 정리하려고 시도하다가 시스템이 충돌하는 문제입니다. 이로 인해 시스템이 예기치 않게 멈추거나 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Revert "PCI/MSI: Unmap MSI-X region on error"
This reverts commit 1a8d4c6ecb4c81261bcdf13556abd4a958eca202.
Commit 1a8d4c6ecb4c ("PCI/MSI: Unmap MSI-X region on error") added an
iounmap(dev->msix_base) on the error path of msix_capability_init() to
release the MSI-X region when msix_setup_interrupts() fails.
When msix_setup_interrupts() fails, the call chain is:
msix_setup_interrupts()
-> __msix_setup_interrupts()
struct pci_dev *dev __free(free_msi_irqs) = __dev;
...
return ret; // __free cleanup fires on error
The __free(free_msi_irqs) cleanup calls pci_free_msi_irqs(), which
already handles the unmap:
void pci_free_msi_irqs(struct pci_dev *dev)
{
pci_msi_teardown_msi_irqs(dev);
if (dev->msix_base) {
iounmap(dev->msix_base); // already unmapped here
dev->msix_base = NULL; // and set to NULL
}
}
So dev->msix_base is unmapped and set to NULL before
msix_setup_interrupts() returns to msix_capability_init(). The
"goto out_unmap" introduced by commit 1a8d4c6ecb4c ("PCI/MSI: Unmap
MSI-X region on error") then calls iounmap() a second time on a NULL
pointer.
This was reproduced on Intel Emerald Rapids (192 CPUs) while
running tools/testing/selftests/kexec/test_kexec_jump.sh:
WARNING: CPU#44 at iounmap+0x2a/0xe0
RIP: 0010:iounmap+0x2a/0xe0
RDI: 0000000000000000
Call Trace:
msix_capability_init+0x317/0x3f0
__pci_enable_msix_range+0x21d/0x2c0
pci_alloc_irq_vectors_affinity+0xa9/0x130
nvme_setup_io_queues+0x2a8/0x420 [nvme]
nvme_reset_work+0x151/0x340 [nvme]
...
RDI=0 confirms iounmap() is called with NULL.
Restore the original "goto out_disable" and leave the unmap to the
existing __free(free_msi_irqs) cleanup.
📍 영향받는 시스템
Linux Kernel (MSI-X 관련 패치가 적용된 특정 버전)
⚔️ 공격 벡터
로컬 공격자가 특정 PCI 장치의 MSI-X 설정 오류를 유도하여 시스템 충돌(DoS)을 일으킬 수 있음
🛡️ 대응 방법
해당 커널 패치(commit 1a8d4c6ecb4c1 revert)가 적용된 최신 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 취약점이 수정된 최신 버전인지 확인