🔍 CVE-2022-49764

5.5
CVSS Score
MEDIUM
2025-05-01
2026-11-05 20:17
✅ 완료

🇰🇷 한글 설명

Linux 커널에서 BPF 프로그램이 raw tracepoint(contention_begin)에 연결된 상태로 bpf_trace_printk 헬퍼를 호출하면, 같은 tracepoint를 재귀적으로 트리거하여 trace_printk_lock 관련 경고와 스핀락 문제가 발생할 수 있습니다. 이를 해결하기 위해 BPF 프로그램이 이미 실행 중이면 재실행을 건너뛰도록 수정되었습니다.

💡 쉬운 설명

커널의 추적 기능 안에서 추적 프로그램이 자기 자신을 반복 호출하면서 시스템이 멈추거나 경고가 발생할 수 있는 문제입니다. 패치는 이미 실행 중인 추적 프로그램이 다시 실행되지 않도록 막아 줍니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: bpf: Prevent bpf program recursion for raw tracepoint probes We got report from sysbot [1] about warnings that were caused by bpf program attached to contention_begin raw tracepoint triggering the same tracepoint by using bpf_trace_printk helper that takes trace_printk_lock lock. Call Trace: <TASK> ? trace_event_raw_event_bpf_trace_printk+0x5f/0x90 bpf_trace_printk+0x2b/0xe0 bpf_prog_a9aec6167c091eef_prog+0x1f/0x24 bpf_trace_run2+0x26/0x90 native_queued_spin_lock_slowpath+0x1c6/0x2b0 _raw_spin_lock_irqsave+0x44/0x50 bpf_trace_printk+0x3f/0xe0 bpf_prog_a9aec6167c091eef_prog+0x1f/0x24 bpf_trace_run2+0x26/0x90 native_queued_spin_lock_slowpath+0x1c6/0x2b0 _raw_spin_lock_irqsave+0x44/0x50 bpf_trace_printk+0x3f/0xe0 bpf_prog_a9aec6167c091eef_prog+0x1f/0x24 bpf_trace_run2+0x26/0x90 native_queued_spin_lock_slowpath+0x1c6/0x2b0 _raw_spin_lock_irqsave+0x44/0x50 bpf_trace_printk+0x3f/0xe0 bpf_prog_a9aec6167c091eef_prog+0x1f/0x24 bpf_trace_run2+0x26/0x90 native_queued_spin_lock_slowpath+0x1c6/0x2b0 _raw_spin_lock_irqsave+0x44/0x50 __unfreeze_partials+0x5b/0x160 ... The can be reproduced by attaching bpf program as raw tracepoint on contention_begin tracepoint. The bpf prog calls bpf_trace_printk helper. Then by running perf bench the spin lock code is forced to take slow path and call contention_begin tracepoint. Fixing this by skipping execution of the bpf program if it's already running, Using bpf prog 'active' field, which is being currently used by trampoline programs for the same reason. Moving bpf_prog_inc_misses_counter to syscall.c because trampoline.c is compiled in just for CONFIG_BPF_JIT option. [1] https://lore.kernel.org/bpf/YxhFe3EwqchC%2FfYf@krava/T/#t

📍 영향받는 시스템

BPF raw tracepoint 기능을 사용하는 Linux 커널 (수정 커밋 이전 버전의 여러 배포판 커널)

⚔️ 공격 벡터

공격자가 BPF 프로그램을 로드할 수 있는 권한(예: CAP_BPF/CAP_SYS_ADMIN)을 가진 상태에서 contention_begin에 연결된 프로그램으로 재귀 호출을 유발해 서비스 거부를 일으킬 수 있습니다.

🛡️ 대응 방법

배포판 제공 최신 커널 업데이트를 적용하고 재부팅하거나, BPF 프로그램 로드 권한을 신뢰할 수 있는 사용자로 제한합니다.

🔧 검증 코드

출력된 커널 버전이 배포판의 보안 업데이트 적용 버전(패치 포함)인지 배포판 보안 공지와 비교하여 확인하며, 최신 보안 업데이트가 설치되어 있으면 취약점이 해결된 것으로 판단합니다.

Shell / Script
uname -r && (dpkg -l 'linux-image*' 2>/dev/null | grep -E '^ii' | head -5 || rpm -q kernel 2>/dev/null)

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

💻 영향받는 소프트웨어

Linux Kernel