🔍 CVE-2024-42239

5.5
CVSS Score
MEDIUM
2024-08-07
2026-10-30 13:17
✅ 완료

🇰🇷 한글 설명

Linux 커널 BPF 서브시스템에서 두 개의 BPF 타이머 콜백이 서로를 동시에 취소하려 할 때 상호 대기로 인해 교착 상태(lockup)가 발생하는 문제입니다. 이를 수정하기 위해 취소 요청 횟수를 세는 atomic 카운터를 도입하고, 콜백 내부에서 취소 충돌이 감지되면 -EDEADLK 오류를 반환하도록 변경되었습니다.

💡 쉬운 설명

두 개의 작업이 서로가 끝나기를 기다리다 영원히 멈추는 상황을 막는 수정입니다. 이제는 서로 취소를 시도하면 오류를 반환해 시스템이 멈추지 않습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: bpf: Fail bpf_timer_cancel when callback is being cancelled Given a schedule: timer1 cb timer2 cb bpf_timer_cancel(timer2); bpf_timer_cancel(timer1); Both bpf_timer_cancel calls would wait for the other callback to finish executing, introducing a lockup. Add an atomic_t count named 'cancelling' in bpf_hrtimer. This keeps track of all in-flight cancellation requests for a given BPF timer. Whenever cancelling a BPF timer, we must check if we have outstanding cancellation requests, and if so, we must fail the operation with an error (-EDEADLK) since cancellation is synchronous and waits for the callback to finish executing. This implies that we can enter a deadlock situation involving two or more timer callbacks executing in parallel and attempting to cancel one another. Note that we avoid incrementing the cancelling counter for the target timer (the one being cancelled) if bpf_timer_cancel is not invoked from a callback, to avoid spurious errors. The whole point of detecting cur->cancelling and returning -EDEADLK is to not enter a busy wait loop (which may or may not lead to a lockup). This does not apply in case the caller is in a non-callback context, the other side can continue to cancel as it sees fit without running into errors. Background on prior attempts: Earlier versions of this patch used a bool 'cancelling' bit and used the following pattern under timer->lock to publish cancellation status. lock(t->lock); t->cancelling = true; mb(); if (cur->cancelling) return -EDEADLK; unlock(t->lock); hrtimer_cancel(t->timer); t->cancelling = false; The store outside the critical section could overwrite a parallel requests t->cancelling assignment to true, to ensure the parallely executing callback observes its cancellation status. It would be necessary to clear this cancelling bit once hrtimer_cancel is done, but lack of serialization introduced races. Another option was explored where bpf_timer_start would clear the bit when (re)starting the timer under timer->lock. This would ensure serialized access to the cancelling bit, but may allow it to be cleared before in-flight hrtimer_cancel has finished executing, such that lockups can occur again. Thus, we choose an atomic counter to keep track of all outstanding cancellation requests and use it to prevent lockups in case callbacks attempt to cancel each other while executing in parallel.

📍 영향받는 시스템

Linux 커널 BPF 타이머 기능을 사용하는 수정 이전 버전 (커널 6.x 계열 일부 및 해당 LTS 브랜치)

⚔️ 공격 벡터

권한이 있는 로컬 사용자가 BPF 프로그램으로 상호 취소하는 타이머 콜백을 구성해 커널 교착 상태를 유발하여 서비스 거부(DoS)를 일으킬 수 있습니다.

🛡️ 대응 방법

배포판에서 제공하는 CVE-2024-42239 수정이 포함된 최신 커널 패키지로 업데이트 후 재부팅하세요.

🔧 검증 코드

출력된 커널 버전을 배포판 보안 공지(CVE-2024-42239 수정 포함 빌드)와 대조하여, 패치된 버전 이상이면 수정된 것이고 그 이전이면 취약할 수 있습니다.

Shell / Script
uname -r

📊 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