🇰🇷 한글 설명
Linux 커널의 IOMMU SVA(Shared Virtual Addressing) 기능에서 커널 페이지 테이블이 해제된 후 재할당될 때, IOMMU가 이전의 잘못된 캐시(IOTLB)를 유지하여 발생하는 취약점입니다. 이로 인해 Use-After-Free 또는 Write-After-Free 상태가 발생하여 권한 상승이나 데이터 손상으로 이어질 수 있습니다.
💡 쉬운 설명
컴퓨터의 메모리 관리 장치가 예전에 사용하던 잘못된 정보를 계속 기억하고 있어서 발생하는 문제입니다. 공격자가 이 잘못된 정보를 이용해 시스템의 중요한 영역에 접근하거나 권한을 탈취할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
iommu: disable SVA when CONFIG_X86 is set
Patch series "Fix stale IOTLB entries for kernel address space", v7.
This proposes a fix for a security vulnerability related to IOMMU Shared
Virtual Addressing (SVA). In an SVA context, an IOMMU can cache kernel
page table entries. When a kernel page table page is freed and
reallocated for another purpose, the IOMMU might still hold stale,
incorrect entries. This can be exploited to cause a use-after-free or
write-after-free condition, potentially leading to privilege escalation or
data corruption.
This solution introduces a deferred freeing mechanism for kernel page
table pages, which provides a safe window to notify the IOMMU to
invalidate its caches before the page is reused.
This patch (of 8):
In the IOMMU Shared Virtual Addressing (SVA) context, the IOMMU hardware
shares and walks the CPU's page tables. The x86 architecture maps the
kernel's virtual address space into the upper portion of every process's
page table. Consequently, in an SVA context, the IOMMU hardware can walk
and cache kernel page table entries.
The Linux kernel currently lacks a notification mechanism for kernel page
table changes, specifically when page table pages are freed and reused.
The IOMMU driver is only notified of changes to user virtual address
mappings. This can cause the IOMMU's internal caches to retain stale
entries for kernel VA.
Use-After-Free (UAF) and Write-After-Free (WAF) conditions arise when
kernel page table pages are freed and later reallocated. The IOMMU could
misinterpret the new data as valid page table entries. The IOMMU might
then walk into attacker-controlled memory, leading to arbitrary physical
memory DMA access or privilege escalation. This is also a
Write-After-Free issue, as the IOMMU will potentially continue to write
Accessed and Dirty bits to the freed memory while attempting to walk the
stale page tables.
Currently, SVA contexts are unprivileged and cannot access kernel
mappings. However, the IOMMU will still walk kernel-only page tables all
the way down to the leaf entries, where it realizes the mapping is for the
kernel and errors out. This means the IOMMU still caches these
intermediate page table entries, making the described vulnerability a real
concern.
Disable SVA on x86 architecture until the IOMMU can receive notification
to flush the paging cache before freeing the CPU kernel page table pages.
📍 영향받는 시스템
CONFIG_X86가 설정된 Linux 커널 (SVA 기능 활성화 시)
⚔️ 공격 벡터
커널 페이지 테이블이 해제되고 재할당되는 시점에 IOMMU의 stale 캐시를 이용한 DMA 접근 및 메모리 조작
🛡️ 대응 방법
커널 패치를 적용하여 커널 페이지 테이블 해제 시 IOMMU 캐시를 무효화하거나, x86 아키텍처에서 SVA 기능을 비활성화합니다.
🔧 검증 코드
현재 커널 버전과 CONFIG_X86 및 CONFIG_IOMMU_SVA 설정이 활성화(y)되어 있는지 확인합니다.
uname -r && grep CONFIG_X86 /boot/config-$(uname -r) && grep CONFIG_IOMMU_SVA /boot/config-$(uname -r)