🇰🇷 한글 설명
Linux 커널의 BPF 오프로드 맵/프로그램 정보 조회 과정에서 네트워크 네임스페이스(netns) 파괴 시 발생하는 Use-After-Free 취약점입니다. get_net() 함수가 참조 카운트가 0인 상태에서 증가를 시도하여 메모리 오류를 유발할 수 있습니다.
💡 쉬운 설명
네트워크 설정이 삭제되는 도중에 시스템이 해당 정보를 읽으려고 시도하면 메모리 충돌이 발생하는 문제입니다. 이로 인해 시스템이 불안정해지거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix use-after-free in offloaded map/prog info fill
When querying info for an offloaded BPF map or program,
bpf_map_offload_info_fill_ns() and bpf_prog_offload_info_fill_ns()
obtain the network namespace with get_net(dev_net(offmap->netdev)).
However, the associated netdev's netns may be racing with teardown
during netns destruction. If the netns refcount has already reached 0,
get_net() performs a refcount_t increment on 0, triggering:
refcount_t: addition on 0; use-after-free.
Although rtnl_lock and bpf_devs_lock ensure the netdev pointer remains
valid, they cannot prevent the netns refcount from reaching zero.
Fix this by using maybe_get_net() instead of get_net(). maybe_get_net()
uses refcount_inc_not_zero() and returns NULL if the refcount is already
zero, which causes ns_get_path_cb() to fail and the caller to return
-ENOENT -- the correct behavior when the netns is being destroyed.
📍 영향받는 시스템
Linux Kernel (BPF offload 기능이 활성화된 버전)
⚔️ 공격 벡터
네트워크 네임스페이스 파괴와 BPF 정보 조회 간의 레이스 컨디션(Race Condition) 유도
🛡️ 대응 방법
get_net() 대신 refcount를 안전하게 확인하는 maybe_get_net()을 사용하는 최신 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전인지 배포판 보안 공지를 통해 확인하십시오.