🇰🇷 한글 설명
Linux 커널 sched_ext에서 SCX_KICK_WAIT의 busy-wait으로 인한 데드락 취약점. kick_cpus_irq_workfn()이 hardirq 컨텍스트에서 다른 CPU의 kick_sync 진행을 기다리는데, 현재 CPU가 재스케줄링될 수 없어 자신의 kick_sync도 진행되지 않으면서 순환 데드락 발생. 이를 resched_curr()로 교체하여 balance callback 메커니즘을 통해 대기하도록 해결하는 패치.
💡 쉬운 설명
Linux 커널의 CPU 스케줄러에서 여러 CPU가 서로의 작업 완료를 기다리며 모두 멈춰버리는 데드락 현상 발생. 이를 CPU가 다른 작업을 처리하면서 대기할 수 있는 방식으로 변경하여 시스템 멈춤을 방지.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
sched_ext: Fix SCX_KICK_WAIT deadlock by deferring wait to balance callback
SCX_KICK_WAIT busy-waits in kick_cpus_irq_workfn() using
smp_cond_load_acquire() until the target CPU's kick_sync advances. Because
the irq_work runs in hardirq context, the waiting CPU cannot reschedule and
its own kick_sync never advances. If multiple CPUs form a wait cycle, all
CPUs deadlock.
Replace the busy-wait in kick_cpus_irq_workfn() with resched_curr() to
force the CPU through do_pick_task_scx(), which queues a balance callback
to perform the wait. The balance callback drops the rq lock and enables
IRQs following the sched_core_balance() pattern, so the CPU can process
IPIs while waiting. The local CPU's kick_sync is advanced on entry to
do_pick_task_scx() and continuously during the wait, ensuring any CPU that
starts waiting for us sees the advancement and cannot form cyclic
dependencies.
📍 영향받는 시스템
sched_ext 기능이 활성화된 Linux 커널 5.10 이상 (특히 AMD EPYC, Intel Xeon 등 멀티코어 서버)
⚔️ 공격 벡터
특정 CPU 스케줄링 조건에서 의도적으로 데드락 유발하여 시스템 무응답 상태 초래 (DoS)
🛡️ 대응 방법
Linux 커널을 최신 버전으로 업그레이드하거나 해당 패치 적용
🔧 검증 코드
커널 버전과 CONFIG에서 SCX_KICK_WAIT 설정 확인. 5.10 이상에서 sched_ext가 활성화되어 있으면 해당 커널 버전의 패치 적용 여부 확인 필요
uname -r | grep -E 'sched.*ext|5\.1[0-9]|6\.' && grep -q 'SCX_KICK_WAIT' /boot/config-$(uname -r) 2>/dev/null && echo 'Vulnerable' || echo 'Check kernel version'