🇰🇷 한글 설명
Linux 커널의 BPF(Berkeley Packet Filter) 구성 요소에서 bpf_tracing_link_release 함수 호출 시 발생하는 경고 및 메모리 손상 취약점입니다. 검증기(verifier)가 트램펄린 플래그를 설정할 때 기존 플래그를 유지하지 않고 덮어씀으로써, fexit 링크 해제 시 프로그램의 nop 명령어를 올바르게 복구하지 못하는 문제가 있습니다.
💡 쉬운 설명
리눅스 커널의 특정 기능을 사용할 때, 프로그램이 종료되는 과정에서 메모리 설정값이 잘못 덮어씌워지는 오류가 있습니다. 이로 인해 시스템의 실행 흐름이 꼬이거나 예기치 않은 동작이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix WARNING in bpf_tracing_link_release
The trampoline could be corrupted by the blindly
'tr->flags = BPF_TRAMP_F_TAIL_CALL_CTX' in verifier.
1. A fexit attached to a tail_call_reachable prog. 'tr->flags' became
'BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_TAIL_CALL_CTX'. And, the
trampoline would poke the target prog's nop insn using jmp insn instead
of call insn.
2. Another fexit loaded with the same tail_call_reachable prog target.
'tr->flags' became 'BPF_TRAMP_F_TAIL_CALL_CTX'.
3. Close the first fexit link. Due to no BPF_TRAMP_F_CALL_ORIG in
'tr->flags', the trampoline will fail to restore the prog's nop insn
using call insn.
[ 3.410719] WARNING: kernel/bpf/syscall.c:3551 at bpf_tracing_link_release+0x53/0x60, CPU#1: test_progs/98
...
[ 3.428793] bpf_link_free+0x58/0x130
[ 3.429293] bpf_link_release+0x23/0x30
Fix the warning by updating 'tr->flags' with '|=' and lock.
📍 영향받는 시스템
Linux Kernel (BPF 기능이 활성화된 버전)
⚔️ 공격 벡터
로컬 공격자가 특수하게 조작된 BPF 프로그램(fexit 및 tail_call_reachable 사용)을 로드하여 커널 메모리 상태를 불안정하게 만듦
🛡️ 대응 방법
커널 패치를 적용하여 tr->flags 업데이트 시 '|=' 연산자를 사용하고 잠금(lock) 메커니즘을 적용한 최신 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인