🇰🇷 한글 설명
Linux 커널의 SKB(Socket Buffer) 메모리 할당/해제 메커니즘에서 KFENCE 활성화 시 발생하는 메모리 부패. 특정 크기의 SKB 헤드가 잘못된 메모리 캐시로 반환되어 slab cross-cache free 오류를 유발합니다.
💡 쉬운 설명
Linux 커널 내 메모리 관리 버그로, 메모리가 잘못된 위치로 반환되어 시스템 불안정성을 초래합니다. 메모리 디버깅 도구가 활성화된 시스템에서만 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net: skb: fix cross-cache free of KFENCE-allocated skb head
SKB_SMALL_HEAD_CACHE_SIZE is intentionally set to a non-power-of-2
value (e.g. 704 on x86_64) to avoid collisions with generic kmalloc
bucket sizes. This ensures that skb_kfree_head() can reliably use
skb_end_offset to distinguish skb heads allocated from
skb_small_head_cache vs. generic kmalloc caches.
However, when KFENCE is enabled, kfence_ksize() returns the exact
requested allocation size instead of the slab bucket size. If a caller
(e.g. bpf_test_init) allocates skb head data via kzalloc() and the
requested size happens to equal SKB_SMALL_HEAD_CACHE_SIZE, then
slab_build_skb() -> ksize() returns that exact value. After subtracting
skb_shared_info overhead, skb_end_offset ends up matching
SKB_SMALL_HEAD_HEADROOM, causing skb_kfree_head() to incorrectly free
the object to skb_small_head_cache instead of back to the original
kmalloc cache, resulting in a slab cross-cache free:
kmem_cache_free(skbuff_small_head): Wrong slab cache. Expected
skbuff_small_head but got kmalloc-1k
Fix this by always calling kfree(head) in skb_kfree_head(). This keeps
the free path generic and avoids allocator-specific misclassification
for KFENCE objects.
📍 영향받는 시스템
KFENCE 활성화된 Linux 커널 (bpf_test_init 또는 유사한 메커니즘 사용 환경)
⚔️ 공격 벡터
특정 크기(SKB_SMALL_HEAD_CACHE_SIZE)의 SKB 헤드 할당을 통해 메모리 캐시 오분류 트리거
🛡️ 대응 방법
최신 Linux 커널 버전으로 업데이트 (이 패치가 포함된 버전 설치)
🔧 검증 코드
CONFIG_KFENCE=y가 출력되면 KFENCE 활성화 상태이며, 커널 릴리스 노트에서 CVE-2026-31429 패치 적용 여부 확인
grep CONFIG_KFENCE /boot/config-$(uname -r) 2>/dev/null && echo 'KFENCE enabled - check kernel version for patch'