🇰🇷 한글 설명
Linux 커널의 BPF 맵 값 재사용 과정에서 특수 필드를 해제할 때 발생하는 안전성 문제를 해결했습니다. 기존에는 업데이트나 삭제 시 모든 필드를 즉시 파괴하려 시도했으나, 이는 NMI 컨텍스트와 같이 안전하지 않은 환경에서 시스템 불안정을 초래할 수 있었습니다. 이를 위해 NMI 안전한 필드만 먼저 취소하고 나머지는 최종 정리 경로로 미루도록 수정되었습니다.
💡 쉬운 설명
데이터를 지우거나 바꿀 때 시스템이 갑자기 멈추거나 오류가 날 수 있는 위험한 동작을 수정했습니다. 특히 매우 긴급한 작업 중에는 위험한 데이터 삭제를 잠시 미루어 시스템을 더 안전하게 만듭니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Cancel special fields on map value recycle
Map update and delete paths currently call bpf_obj_free_fields() when a
value is being replaced or recycled. That makes field destruction depend
on the context of the update/delete operation. For tracing programs this
can include NMI context, where referenced kptr destructors, uptr
unpinning, and graph root destruction are not generally safe.
Introduce bpf_obj_cancel_fields() for the reusable-value path. It only
performs NMI-safe cleanup for timer, workqueue, and task_work fields.
Fields that need full destruction are left attached to the recycled value
and are destroyed by the final cleanup path instead.
Switch array and hashtab update/delete/recycle paths to this cancel
helper. Keep bpf_obj_free_fields() for final map destruction and for
bpf_mem_alloc destructors. Preallocated hashtabs do not have allocator
destructors, so teardown continues to walk the normal and extra elements
and fully destroy their fields.
This deliberately relaxes the eager-free semantics of map update/delete
for special fields. Programs that relied on a recycled map slot becoming
empty immediately after update/delete were relying on behavior that
cannot be implemented safely from every BPF execution context without
offloading arbitrary destructors.
There is a chance this change breaks programs making assumptions
regarding the eager freeing of fields. If so, we can relax semantics to
cancellation only when irqs_disabled() is true in the future. However,
theoretically, map values that get reused eagerly already have weaker
guarantees as parallel users can recreate freed fields before the new
element becomes visible again.
📍 영향받는 시스템
Linux Kernel (BPF 기능이 활성화된 버전)
⚔️ 공격 벡터
특정 BPF 프로그램 실행 중 NMI(Non-Maskable Interrupt) 컨텍스트에서 부적절한 메모리 해제를 유도하여 시스템 불안정 유발
🛡️ 대응 방법
해당 취약점이 해결된 최신 Linux 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 패치가 적용된 최신 배포판의 버전인지 확인