🔍 CVE-2024-58070

7.8
CVSS Score
HIGH
2025-03-06
2026-08-04 11:22
✅ 완료

🇰🇷 한글 설명

Linux 커널의 PREEMPT_RT 환경에서 bpf_local_storage가 부적절한 메모리 할당 방식을 사용하여 발생하는 취약점입니다. 비선점(non-preemptible) 컨텍스트에서 안전하지 않은 kmalloc(GFP_ATOMIC) 대신 bpf_mem_alloc을 사용하도록 강제하여 커널 충돌 및 불안정성을 방지합니다.

💡 쉬운 설명

리눅스 운영체제의 특정 실시간 설정에서 메모리를 할당하는 방식이 잘못되어 시스템이 멈추거나 오류가 발생할 수 있는 문제입니다. 이를 수정하기 위해 메모리 할당 규칙을 더 안전한 방식으로 변경하는 패치가 적용되었습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: bpf: bpf_local_storage: Always use bpf_mem_alloc in PREEMPT_RT In PREEMPT_RT, kmalloc(GFP_ATOMIC) is still not safe in non preemptible context. bpf_mem_alloc must be used in PREEMPT_RT. This patch is to enforce bpf_mem_alloc in the bpf_local_storage when CONFIG_PREEMPT_RT is enabled. [ 35.118559] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 [ 35.118566] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1832, name: test_progs [ 35.118569] preempt_count: 1, expected: 0 [ 35.118571] RCU nest depth: 1, expected: 1 [ 35.118577] INFO: lockdep is turned off. ... [ 35.118647] __might_resched+0x433/0x5b0 [ 35.118677] rt_spin_lock+0xc3/0x290 [ 35.118700] ___slab_alloc+0x72/0xc40 [ 35.118723] __kmalloc_noprof+0x13f/0x4e0 [ 35.118732] bpf_map_kzalloc+0xe5/0x220 [ 35.118740] bpf_selem_alloc+0x1d2/0x7b0 [ 35.118755] bpf_local_storage_update+0x2fa/0x8b0 [ 35.118784] bpf_sk_storage_get_tracing+0x15a/0x1d0 [ 35.118791] bpf_prog_9a118d86fca78ebb_trace_inet_sock_set_state+0x44/0x66 [ 35.118795] bpf_trace_run3+0x222/0x400 [ 35.118820] __bpf_trace_inet_sock_set_state+0x11/0x20 [ 35.118824] trace_inet_sock_set_state+0x112/0x130 [ 35.118830] inet_sk_state_store+0x41/0x90 [ 35.118836] tcp_set_state+0x3b3/0x640 There is no need to adjust the gfp_flags passing to the bpf_mem_cache_alloc_flags() which only honors the GFP_KERNEL. The verifier has ensured GFP_KERNEL is passed only in sleepable context. It has been an old issue since the first introduction of the bpf_local_storage ~5 years ago, so this patch targets the bpf-next. bpf_mem_alloc is needed to solve it, so the Fixes tag is set to the commit when bpf_mem_alloc was first used in the bpf_local_storage.

📍 영향받는 시스템

CONFIG_PREEMPT_RT가 활성화된 Linux 커널 (bpf_local_storage 기능 사용 시)

⚔️ 공격 벡터

특정 BPF 프로그램을 실행하여 커널의 비선점 컨텍스트에서 잘못된 메모리 할당을 유도함으로써 시스템 불안정성 유발

🛡️ 대응 방법

커널 패치를 적용하여 bpf_local_storage에서 bpf_mem_alloc을 사용하도록 업데이트

🔧 검증 코드

출력된 커널 버전과 CONFIG_PREEMPT_RT 설정이 'y'인지 확인하여 해당 환경 여부를 판단합니다.

Shell / Script
uname -r && grep CONFIG_PREEMPT_RT /boot/config-$(uname -r)

📊 CVSS Vector String

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

💻 영향받는 소프트웨어

Linux Kernel