🇰🇷 한글 설명
Linux 커널의 x86 아키텍처에서 BPF 프로그램 팩을 처리할 때 발생하는 메모리 해제 오류 취약점입니다. 여러 개의 서브 프로그램이 포함된 경우, 컴파일 실패 시 일부 프로그램이 제대로 마무리되지 않은 상태에서 메모리가 잘못 해제되어 시스템 불안정이나 메모리 손상을 초래할 수 있습니다.
💡 쉬운 설명
컴퓨터의 핵심 운영체제인 리눅스에서 복잡한 프로그램을 실행할 때 메모리를 정리하는 과정에 실수가 발생하는 문제입니다. 이 실수를 이용하면 컴퓨터의 메모리 관리 체계에 혼란을 주어 시스템을 멈추게 하거나 오류를 일으킬 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf, x86: fix freeing of not-finalized bpf_prog_pack
syzbot reported a few issues with bpf_prog_pack [1], [2]. This only happens
with multiple subprogs. In jit_subprogs(), we first call bpf_int_jit_compile()
on each sub program. And then, we call it on each sub program again. jit_data
is not freed in the first call of bpf_int_jit_compile(). Similarly we don't
call bpf_jit_binary_pack_finalize() in the first call of bpf_int_jit_compile().
If bpf_int_jit_compile() failed for one sub program, we will call
bpf_jit_binary_pack_finalize() for this sub program. However, we don't have a
chance to call it for other sub programs. Then we will hit "goto out_free" in
jit_subprogs(), and call bpf_jit_free on some subprograms that haven't got
bpf_jit_binary_pack_finalize() yet.
At this point, bpf_jit_binary_pack_free() is called and the whole 2MB page is
freed erroneously.
Fix this with a custom bpf_jit_free() for x86_64, which calls
bpf_jit_binary_pack_finalize() if necessary. Also, with custom
bpf_jit_free(), bpf_prog_aux->use_bpf_prog_pack is not needed any more,
remove it.
[1] https://syzkaller.appspot.com/bug?extid=2f649ec6d2eea1495a8f
[2] https://syzkaller.appspot.com/bug?extid=87f65c75f4a72db05445
📍 영향받는 시스템
Linux kernel (x86_64 architecture) using BPF with multiple subprograms
⚔️ 공격 벡터
특수하게 조작된 BPF 프로그램을 로드하여 커널의 메모리 해제 로직 오류를 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인