🇰🇷 한글 설명
Linux 커널의 BPF 검증기에서 BPF_LOAD_ACQ 명령어가 결함 보호가 필요한 포인터에 대해 적절히 처리되지 않는 취약점입니다. 일반적인 로드 명령과 달리 BPF_LOAD_ACQ는 예외 테이블(extable) 없이 JIT 컴파일되어, 잘못된 메모리 접근 시 커널 패닉을 유발할 수 있습니다.
💡 쉬운 설명
특수한 방식으로 메모리를 읽어오는 명령어가 보안 검사를 건너뛰어 시스템을 갑자기 멈추게 만들 수 있는 문제입니다. 공격자가 이를 이용하면 시스템을 강제로 다운시켜 서비스 중단을 일으킬 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Reject load-acquire from pointers requiring fault protection
A BPF_LOAD_ACQ is not rewritten to a BPF_PROBE_MEM load by the verifier,
unlike a regular BPF_LDX, so the JIT emits a plain load with no exception
table entry and a fault panics the kernel instead of being handled.
Reject the source pointer types that a BPF_LDX would have had that fault
protection applied to, i.e. the ones bpf_convert_ctx_accesses() turns
into BPF_PROBE_MEM: a bare PTR_TO_BTF_ID, PTR_TO_BTF_ID | PTR_UNTRUSTED,
PTR_TO_BTF_ID | MEM_ALLOC | PTR_UNTRUSTED and PTR_TO_MEM | MEM_RDONLY |
PTR_UNTRUSTED.
This is reachable e.g. by loading ->mm out of a trusted task_struct
yields an untrusted pointer to mm_struct, and it is NULL for a kernel
thread:
[...]
SEC("tp_btf/sched_switch")
int BPF_PROG(demo, bool preempt, struct task_struct *prev,
struct task_struct *next)
{
struct mm_struct *mm = next->mm; /* untrusted */
out_ldx = (__u64)mm->pgd; /* BPF_LDX */
out_acq = load_acquire(&mm->pgd); /* BPF_LOAD_ACQ */
return 0;
}
[...]
Both dereference the same pointer, but only the BPF_LDX is protected
(x86-64 JIT, jump targets shown prog-relative):
[...]
; out_ldx = (__u64)mm->pgd;
17: movq $-10485760, %r10
1e: movq %rsi, %r11
21: addq $184, %r11
28: subq %r10, %r11
2b: movabsq $140737498841088, %r10
35: cmpq %r10, %r11
38: ja 0x3e <-- kernel addr?
3a: xorl %edi, %edi <-- no: dst = 0, skip the load
3c: jmp 0x45
3e: movq 184(%rsi), %rdi <-- yes: load + extable entry
[...]
; load_acquire(&mm->pgd)
53: movq %rsi, %rdi
56: movq 184(%rdi), %rax <-- no check, no extable entry
[...]
Note that BPF_PROBE_MEM is not visible in a bpftool xlated dump, as
bpf_insn_prepare_dump() rewrites it back to BPF_MEM.
A PTR_TRUSTED pointer is deliberately not on the list. Such a load is
not converted either, but it does not need to be, since the pointer is
guaranteed live, so load-acquire from it stays allowed.
The check is gated on BPF_LOAD_ACQ so that atomic RMW and store-release
error messages are unchanged; writes (RMW / store-release) to such
pointers are already rejected elsewhere, so only load-acquire needs this.
📍 영향받는 시스템
Linux Kernel (BPF 기능이 활성화된 버전)
⚔️ 공격 벡터
신뢰할 수 없는 포인터(untrusted pointer)를 사용하는 BPF 프로그램을 로드하여 커널 예외 처리가 없는 메모리 접근을 유도함
🛡️ 대응 방법
해당 취약점이 해결된 최신 Linux 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인합니다.