🇰🇷 한글 설명
Linux 커널의 hrtimers 서브시스템에서 CPU 핫플러그 상태 전환 시 CPU 상태를 올바르게 관리하지 못하는 취약점입니다. CPU가 온라인에서 준비 상태로 이동했다가 다시 온라인으로 돌아올 때, hrtimers 상태가 제대로 초기화되지 않아 스케줄러가 타이머를 잘못 관리하게 됩니다. 클록이벤트 장치가 원샷 모드로 전환되지 않거나 시스템 불안정성이 발생할 수 있습니다.
💡 쉬운 설명
CPU를 껐다 켤 때 타이머 설정이 제대로 초기화되지 않는 문제입니다. 이로 인해 스케줄러가 타이머를 잘못 관리하여 시스템이 불안정해질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
hrtimers: Handle CPU state correctly on hotplug
Consider a scenario where a CPU transitions from CPUHP_ONLINE to halfway
through a CPU hotunplug down to CPUHP_HRTIMERS_PREPARE, and then back to
CPUHP_ONLINE:
Since hrtimers_prepare_cpu() does not run, cpu_base.hres_active remains set
to 1 throughout. However, during a CPU unplug operation, the tick and the
clockevents are shut down at CPUHP_AP_TICK_DYING. On return to the online
state, for instance CFS incorrectly assumes that the hrtick is already
active, and the chance of the clockevent device to transition to oneshot
mode is also lost forever for the CPU, unless it goes back to a lower state
than CPUHP_HRTIMERS_PREPARE once.
This round-trip reveals another issue; cpu_base.online is not set to 1
after the transition, which appears as a WARN_ON_ONCE in enqueue_hrtimer().
Aside of that, the bulk of the per CPU state is not reset either, which
means there are dangling pointers in the worst case.
Address this by adding a corresponding startup() callback, which resets the
stale per CPU state and sets the online flag.
[ tglx: Make the new callback unconditionally available, remove the online
modification in the prepare() callback and clear the remaining
state in the starting callback instead of the prepare callback ]
📍 영향받는 시스템
Linux kernel 모든 버전 (Debian, Ubuntu, Red Hat, CentOS 등 - 커널 버전에 따라 다름)
⚔️ 공격 벡터
로컬 공격, CPU 핫플러그 권한 필요 (일반적으로 root)
🛡️ 대응 방법
Linux 커널을 패치된 최신 버전으로 업그레이드
🔧 검증 코드
커널 버전을 확인한 후 배포판의 보안 공지에서 CVE-2024-57951 패치 적용 여부를 확인하고 필요시 커널 업데이트 수행
uname -r && cat /proc/cmdline | grep -q cpu_hotplug && echo 'hotplug_enabled' || echo 'check_kernel_version'