🇰🇷 한글 설명
Linux 커널의 bpf_get_btf_vmlinux 함수에서 vmlinux BTF를 준비하는 과정 중 레이스 컨디션 취약점이 발견되었습니다. 약한 메모리 순서(weakly ordered)를 사용하는 아키텍처에서 포인터가 초기화되지 않은 데이터와 함께 노출될 수 있는 문제입니다. 이를 해결하기 위해 smp_store_release()와 smp_load_acquire()를 사용하여 메모리 가시성을 보장하도록 수정되었습니다.
💡 쉬운 설명
컴퓨터가 데이터를 준비하는 도중에 다른 프로그램이 완성되지 않은 데이터를 먼저 읽어버릴 수 있는 오류입니다. 이로 인해 시스템이 불안정해지거나 예상치 못한 동작을 일으킬 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix vmlinux BTF prep race in bpf_get_btf_vmlinux
bpf_get_btf_vmlinux() lazily parses the vmlinux BTF under the
bpf_verifier_lock, but publishes the result through a plain store
and re-checks it through a plain lockless load. Nothing orders
the stores initializing the struct btf inside btf_parse_vmlinux()
against the store publishing the pointer: On a weakly ordered
arch, a concurrent first-time caller taking the lockless fast
path could in principle observe the pointer before the parsed
contents are visible. The mutex_unlock() does not help such a
reader given it only synchronizes with a later acquisition of the
same lock. Thus, publish the pointer with smp_store_release()
and read it on the fast path with smp_load_acquire().
Acquire semantics are needed rather than a dependency-ordered
READ_ONCE(): btf_parse_vmlinux() also populates globals outside
the returned object (e.g. bpf_ctx_convert.t). An address
dependency would only order accesses performed through the
pointer and not cover other globals.
📍 영향받는 시스템
Linux kernel (bpf 관련 기능이 활성화된 시스템)
⚔️ 공격 벡터
약한 메모리 모델을 사용하는 아키텍처에서 동시성 레이스 컨디션을 이용한 메모리 접근
🛡️ 대응 방법
커널 패치를 적용하여 bpf_get_btf_vmlinux의 메모리 배리어(smp_store_release/smp_load_acquire)를 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 최신 패치 버전인지 확인하십시오.