🇰🇷 한글 설명
Linux 커널의 AMD IOMMU 구현 중 __rlookup_amd_iommu() 함수에서 devid에 대한 경계 검사가 누락된 취약점입니다. IVRS에 정의되지 않은 PCI 장치가 존재할 경우, 할당된 범위를 벗어난 메모리를 참조하여 부팅 시 일반 보호 오류(GPF)를 발생시키고 시스템이 중단될 수 있습니다.
💡 쉬운 설명
컴퓨터 부품을 관리하는 목록에서 정해진 범위를 벗어난 번호를 참조하여 시스템이 충돌하는 문제입니다. 이로 인해 특정 환경에서 컴퓨터가 켜지는 도중 오류가 발생하며 멈출 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
iommu/amd: Bounds-check devid in __rlookup_amd_iommu()
iommu_device_register() walks every device on the PCI bus via
bus_for_each_dev() and calls amd_iommu_probe_device() for each. The
inlined check_device() path computes the device's sbdf, calls
rlookup_amd_iommu() to find the owning IOMMU, and only afterwards
verifies devid <= pci_seg->last_bdf. __rlookup_amd_iommu() indexes
rlookup_table[devid] with no bounds check of its own, so for a PCI
device whose BDF is not described by the IVRS, the lookup reads past
the end of the allocation before the caller's bounds check can run.
This was harmless before commit e874c666b15b ("iommu/amd: Change
rlookup, irq_lookup, and alias to use kvalloc()"): the table was a
zeroed page-order allocation, so the over-read returned NULL and the
caller's NULL check skipped the device. After that commit the table is
a tight kvcalloc() and the over-read returns adjacent slab contents,
which check_device() then dereferences as a struct amd_iommu *,
causing a boot-time GPF.
Seen on Google Compute Engine ct6e VMs, where the virtualized IVRS
describes only the four TPU endpoints 00:04.0-07.0; the gVNIC at
00:08.0 (devid 0x40) indexes 56 bytes past the 456-byte allocation,
into the adjacent kmalloc-512 slab object:
pci 0000:00:04.0: Adding to iommu group 0
pci 0000:00:05.0: Adding to iommu group 1
pci 0000:00:06.0: Adding to iommu group 2
pci 0000:00:07.0: Adding to iommu group 3
Oops: general protection fault, probably for non-canonical address 0x3a64695f78746382: 0000 [#1] SMP NOPTI
CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.18.22 #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/06/2025
RIP: 0010:amd_iommu_probe_device+0x54/0x3a0
Call Trace:
__iommu_probe_device+0x107/0x520
probe_iommu_group+0x29/0x50
bus_for_each_dev+0x7e/0xe0
iommu_device_register+0xc9/0x240
iommu_go_to_state+0x9c0/0x1c60
amd_iommu_init+0x14/0x40
pci_iommu_init+0x16/0x60
do_one_initcall+0x47/0x2f0
Guard the array access in __rlookup_amd_iommu(). With the fix applied
on 6.18.22, the gVNIC at 00:08.0 is skipped cleanly and the VM boots.
📍 영향받는 시스템
Linux kernel (6.18.22 미만 버전 및 AMD IOMMU를 사용하는 시스템)
⚔️ 공격 벡터
물리적/가상화 환경에서 IVRS에 정의되지 않은 PCI 장치를 배치하여 부팅 시 커널 패닉 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전(6.18.22 이상 등)으로 업데이트
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 6.18.22 버전 이상인지 확인합니다.