🇰🇷 한글 설명
Linux 커널의 amd_sfh 드라이버에서 PCI BAR 2의 크기를 검증하지 않아 발생하는 취약점입니다. 드라이버가 할당된 BAR 크기보다 큰 오프셋의 MMIO 레지스터에 접근할 경우, 경계 외 메모리 접근(Out-of-bounds access)이 발생하여 프로브 과정에서 페이지 폴트 및 시스템 오류를 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터 부품과 통신하는 드라이버가 부품이 제공하는 메모리 공간의 크기를 확인하지 않고 너무 먼 곳의 데이터를 읽으려다 시스템이 멈추거나 오류가 발생하는 문제입니다. 이는 잘못된 메모리 주소 접근으로 인해 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
HID: amd_sfh: Validate PCI BAR size before mapping
The amd_sfh driver maps PCI BAR 2 using pcim_iomap_regions() and
subsequently accesses MMIO registers at offsets up to 0x10958 (e.g.,
AMD_P2C_MSG3 at 0x1068C). However, the driver never validates that the BAR
size is large enough to cover these accesses. If the driver is bound to a
device with a smaller BAR 2, this leads to an out-of-bounds memory access
and a page fault during the probe function.
For example, a page fault can occur when reading from privdata->mmio +
AMD_P2C_MSG3 in mp2_select_ops():
BUG: unable to handle page fault for address: ffffc9000390368c
PGD 100000067 P4D 100000067 PUD 1012c1067 PMD 105b64067 PTE 0
Oops: Oops: 0000 [#1] SMP KASAN NOPTI
RIP: 0010:readl arch/x86/include/asm/io.h:59 [inline]
RIP: 0010:mp2_select_ops drivers/hid/amd-sfh-hid/amd_sfh_pcie.c:282
[inline]
RIP: 0010:amd_mp2_pci_probe+0x337/0x5f0
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c:487
Call Trace:
<TASK>
local_pci_probe drivers/pci/pci-driver.c:332 [inline]
pci_call_probe drivers/pci/pci-driver.c:394 [inline]
__pci_device_probe drivers/pci/pci-driver.c:455 [inline]
pci_device_probe+0x431/0xc90 drivers/pci/pci-driver.c:489
Fix this by verifying that the length of BAR 2 is at least 128KB before
attempting to map it. Since the maximum accessed offset is 0x10958, and PCI
BAR sizes are powers of 2, any legitimate hardware will have a BAR size of
at least 128KB.
📍 영향받는 시스템
AMD SFH(Sensor Fusion Hub) 드라이버를 사용하는 Linux 커널 시스템
⚔️ 공격 벡터
물리적 또는 가상화된 환경에서 크기가 작은 PCI BAR 2를 가진 장치를 연결하여 드라이버의 메모리 접근 오류 유도
🛡️ 대응 방법
amd_sfh 드라이버가 PCI BAR 2를 매핑하기 전에 해당 크기가 최소 128KB 이상인지 확인하도록 커널 패치 적용
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 수정된 최신 커널 패치가 적용되었는지 확인합니다.
💻 영향받는 소프트웨어
IBM Security Verify Access