🇰🇷 한글 설명
Linux 커널의 BPF 구성 요소에서 상수 블라인딩(constant blinding) 과정 중 offload->prog 포인터가 업데이트되지 않아 발생하는 취약점입니다. 이로 인해 프로그램이 해제된 후에도 잘못된 메모리 주소를 참조하게 되어 네트워크 네임스페이스 삭제 시 페이지 폴트(Page Fault)와 시스템 오류를 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터가 보안을 위해 프로그램을 변환하는 과정에서, 이미 삭제된 데이터의 위치를 계속 기억하고 있어 발생하는 오류입니다. 이 오류가 발생하면 시스템이 갑자기 멈추거나 충돌할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix stale offload->prog pointer after constant blinding
When a dev-bound-only BPF program (BPF_F_XDP_DEV_BOUND_ONLY) undergoes
JIT compilation with constant blinding enabled (bpf_jit_harden >= 2),
bpf_jit_blind_constants() clones the program. The original prog is then
freed in bpf_jit_prog_release_other(), which updates aux->prog to point
to the surviving clone, but fails to update offload->prog.
This leaves offload->prog pointing to the freed original program. When
the network namespace is subsequently destroyed, cleanup_net() triggers
bpf_dev_bound_netdev_unregister(), which iterates ondev->progs and calls
__bpf_prog_offload_destroy(offload->prog). Accessing the freed prog
causes a page fault:
BUG: unable to handle page fault for address: ffffc900085f1038
Workqueue: netns cleanup_net
RIP: 0010:__bpf_prog_offload_destroy+0xc/0x80
Call Trace:
__bpf_offload_dev_netdev_unregister+0x257/0x350
bpf_dev_bound_netdev_unregister+0x4a/0x90
unregister_netdevice_many_notify+0x2a2/0x660
...
cleanup_net+0x21a/0x320
The test sequence that triggers this reliably is:
1. Set net.core.bpf_jit_harden=2 (echo 2 > /proc/sys/net/core/bpf_jit_harden)
2. Run xdp_metadata selftest, which creates a dev-bound-only XDP
program on a veth inside a netns (./test_progs -t xdp_metadata)
3. cleanup_net -> page fault in __bpf_prog_offload_destroy
Dev-bound-only programs are unique in that they have an offload structure
but go through the normal JIT path instead of bpf_prog_offload_compile().
This means they are subject to constant blinding's prog clone-and-replace,
while also having offload->prog that must stay in sync.
Fix this by updating offload->prog in bpf_jit_prog_release_other(),
alongside the existing aux->prog update. Both are back-pointers to
the prog that must be kept in sync when the prog is replaced.
📍 영향받는 시스템
Linux Kernel (BPF_F_XDP_DEV_BOUND_ONLY 및 bpf_jit_harden >= 2 설정이 활성화된 환경)
⚔️ 공격 벡터
특정 조건(JIT hardening 활성화 및 XDP 프로그램 사용) 하에서 네트워크 네임스페이스를 생성하고 삭제하는 과정을 통해 시스템 충돌 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 bpf_jit_prog_release_other() 함수의 수정 사항을 반영해야 합니다.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인합니다.