🇰🇷 한글 설명
Linux 커널의 BPF 메모리 할당기에서 할당된 객체를 초기화하지 않아 발생하는 취약점입니다. htab 맵 사용 시 해제된 메모리 요소가 즉시 재사용되면서 bpf_spin_lock과 같은 특수 필드가 제대로 초기화되지 않아 시스템이 하드 락업(Hard-lockup) 상태에 빠질 수 있습니다.
💡 쉬운 설명
컴퓨터의 메모리를 관리하는 과정에서 이전에 사용하던 데이터가 깨끗하게 지워지지 않아 발생합니다. 이로 인해 시스템이 중요한 작업을 처리하다가 멈춰버리는 현상이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Zeroing allocated object from slab in bpf memory allocator
Currently the freed element in bpf memory allocator may be immediately
reused, for htab map the reuse will reinitialize special fields in map
value (e.g., bpf_spin_lock), but lookup procedure may still access
these special fields, and it may lead to hard-lockup as shown below:
NMI backtrace for cpu 16
CPU: 16 PID: 2574 Comm: htab.bin Tainted: G L 6.1.0+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
RIP: 0010:queued_spin_lock_slowpath+0x283/0x2c0
......
Call Trace:
<TASK>
copy_map_value_locked+0xb7/0x170
bpf_map_copy_value+0x113/0x3c0
__sys_bpf+0x1c67/0x2780
__x64_sys_bpf+0x1c/0x20
do_syscall_64+0x30/0x60
entry_SYSCALL_64_after_hwframe+0x46/0xb0
......
</TASK>
For htab map, just like the preallocated case, these is no need to
initialize these special fields in map value again once these fields
have been initialized. For preallocated htab map, these fields are
initialized through __GFP_ZERO in bpf_map_area_alloc(), so do the
similar thing for non-preallocated htab in bpf memory allocator. And
there is no need to use __GFP_ZERO for per-cpu bpf memory allocator,
because __alloc_percpu_gfp() does it implicitly.
📍 영향받는 시스템
Linux kernel (BPF htab map을 사용하는 환경)
⚔️ 공격 벡터
특수하게 조작된 BPF 맵 조작을 통한 메모리 재사용 유도 및 시스템 중단
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 BPF 메모리 할당 시 객체 초기화(Zeroing)를 수행하도록 수정해야 합니다.
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인합니다.