🇰🇷 한글 설명
Linux 커널의 BPF 트램펄린 기능에서 프로그램이 분리될 때 RCU grace period를 충분히 기다리지 않아 발생하는 메모리 해제 오류입니다. 선점형 커널(Preemptible kernel)에서 트램펄린 내에서 선점된 작업이 이미 해제된 프로그램을 호출함으로써 Use-After-Free 및 메모리 범위 초과 오류를 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터의 핵심 운영체제인 리눅스에서 특정 프로그램이 사용 중인데 너무 빨리 메모리에서 지워버려 발생하는 오류입니다. 이로 인해 시스템이 갑자기 멈추거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Wait for an RCU tasks grace period before freeing trampoline progs
When a prog is detached from a trampoline, it is freed after an RCU
grace period, or an RCU tasks trace one if it is sleepable. This covers
the tasks that are running the prog, since the prog's enter helper takes
the matching read lock before the prog is called. On a preemptible
kernel, it doesn't cover a task that was preempted in the trampoline
just before the enter helper. That task holds no lock yet, and it calls
the prog after it was freed:
BUG: KASAN: vmalloc-out-of-bounds in __bpf_prog_enter_recur+0x3a5/0x3f0
Read of size 8 at addr ffffc90000055040 by task candidate/110
CPU: 1 UID: 0 PID: 110 Comm: candidate Not tainted 7.3.0-rc2-00014-g15071f2a1263-dirty #2 PREEMPT(full)
Call Trace:
<TASK>
__bpf_prog_enter_recur+0x3a5/0x3f0
bpf_trampoline_6442509193+0x37/0xf1
__x64_sys_futex+0x9/0x410
do_syscall_64+0xb0/0x530
...
Wait for an RCU tasks grace period before the existing one when freeing
a prog that was linked to a trampoline. An RCU tasks grace period only
ends once the tasks that were preempted have run again, and
bpf_tramp_image_put() already relies on it to free the image. It doesn't
wait for tasks that sleep in the trampoline, the next commit takes care
of those.
Only progs that were linked to a trampoline can be called this way, so
bpf_trampoline_add_prog() marks them and other progs are still freed as
before.
📍 영향받는 시스템
Linux kernel (specifically versions using BPF trampolines, including 7.3.0-rc2 and potentially earlier)
⚔️ 공격 벡터
로컬 공격자가 BPF 프로그램을 조작하여 특정 타이밍에 메모리 해제 후 접근(Use-After-Free)을 유도함
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 RCU tasks grace period 대기 로직을 적용해야 함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 최신 패치 버전인지 확인합니다.