🇰🇷 한글 설명
Linux 커널의 page_pool 구성 요소에서 xa_cmpxchg 경합 조건으로 인해 발생하는 Use-After-Free(UAF) 취약점입니다. page_pool_destroy()가 실행되는 동안 다른 CPU에서 페이지 반환이 동시에 발생할 경우, 이미 해제된 페이지의 메모리에 접근하게 되어 시스템 불안정이나 보안 문제를 야기할 수 있습니다.
💡 쉬운 설명
컴퓨터 메모리를 관리하는 과정에서 두 가지 작업이 동시에 충돌하여, 이미 사용이 끝난 메모리 영역을 다시 건드리는 오류가 발생합니다. 이로 인해 시스템이 갑자기 멈추거나 해커가 시스템 권한을 탈취할 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net: page_pool: fix UAF in __page_pool_release_netmem_dma on xa_cmpxchg race
This bug was discovered while testing the hns3 driver under channel
reconfiguration (`ethtool -L` / `ethtool -G`) with iperf3 traffic on
arm64. The race is intermittently triggered when page_pool_destroy()
runs page_pool_scrub() concurrently with page return via
page_pool_put_netmem() on a different CPU. A WARN in
page_pool_clear_pp_info() surfaced the dangling DMA index bits left
by the cmpxchg loser, which led to the investigation.
page_pool_scrub() iterates pool->dma_mapped via xa_for_each() with no
page ref held. __page_pool_release_netmem_dma() currently reads and
writes netmem fields (dma_addr, DMA index bits in pp_magic) after
xa_cmpxchg() returns. The unref path calls put_page() unconditionally
regardless of the cmpxchg outcome; when it loses the cmpxchg, it still
frees the page before the scrub winner finishes these netmem accesses,
so scrub touches a freed page -- a Use-After-Free.
Fix this by splitting the DMA release into two functions:
1. __page_pool_unmap_netmem_dma() caches dma_addr before xa_cmpxchg(),
does the cmpxchg to remove the DMA mapping, and calls dma_unmap on
the cached address. It never touches netmem fields after the cmpxchg,
making it safe for the scrub path which holds no page ref.
2. __page_pool_release_netmem_dma() wraps the above and additionally
clears dma_addr and DMA index bits in netmem fields. This is safe
only when the caller holds a page ref, so it is used by the return
path (page_pool_return_netmem).
The scrub path calls __page_pool_unmap_netmem_dma() directly; the return
path calls __page_pool_release_netmem_dma().
📍 영향받는 시스템
Linux kernel (arm64 아키텍처 및 hns3 드라이버 사용 환경에서 특히 유효)
⚔️ 공격 벡터
네트워크 채널 재설정(ethtool -L/G)과 대량의 네트워크 트래픽(iperf3)을 동시에 발생시켜 경합 조건을 유도하는 방식
🛡️ 대응 방법
DMA 해제 로직을 분리하여 메모리 참조 안전성을 확보한 최신 Linux 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 최신 패치 버전인지 확인하십시오.