🇰🇷 한글 설명
리눅스 커널의 kmemleak 기능이 태스크 스택을 스캔할 때 단일 RCU 읽기 측 임계 구역 내에서 재스케줄링 없이 모든 스택을 탐색하여 소프트 락업(soft lockup)을 유발할 수 있는 취약점입니다. 스레드가 매우 많은 호스트 환경에서 CPU 점유율이 과도하게 높아져 시스템 감시 장치(watchdog)가 작동할 수 있습니다.
💡 쉬운 설명
컴퓨터의 메모리 누수를 찾는 기능이 너무 많은 작업을 한꺼번에 처리하려다 시스템을 일시적으로 멈추게 만들 수 있는 문제입니다. 스레드가 아주 많은 서버에서 시스템이 버벅이거나 경고 메시지가 뜰 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm/kmemleak: avoid soft lockup when scanning task stacks
Patch series "mm/kmemleak: avoid soft lockup when scanning task", v3.
kmemleak_scan() scans every task stack under one rcu_read_lock() with no
reschedule point, which can trip the soft lockup watchdog on hosts with
very many threads.
That prints the following message, depending on the workload+host
configuration:
watchdog: BUG: soft lockup - CPU#35 stuck for 22s! [kmemleak:537]
scan_block
kmemleak_scan
kmemleak_scan_thread
kthread
Patch 1 walks the tasks with find_ge_pid() so the scan reschedules between
tasks
Patches 2-3 let the scan loops stop early once a scan is interrupted.
This patch (of 3):
kmemleak_scan() walks every thread and scans its kernel stack under a
single rcu_read_lock() with no reschedule point. On a host with very many
threads -- amplified by KASAN/lockdep in debug builds -- this loop can hog
a CPU long enough to trip the soft lockup watchdog:
watchdog: BUG: soft lockup - CPU#35 stuck for 22s! [kmemleak:537]
scan_block
kmemleak_scan
kmemleak_scan_thread
kthread
A cond_resched() cannot be added directly: the loop runs inside an RCU
read-side critical section.
Walk the tasks one PID at a time with find_ge_pid(), taking the RCU read
lock only to look up and pin each task. The stack is then scanned with no
lock held, so cond_resched() runs between tasks and the scan stops early
on scan_should_stop(). This follows the next_tgid()/task_seq_get_next()
iteration pattern and keeps each RCU critical section short.
📍 영향받는 시스템
Linux Kernel (kmemleak 기능이 활성화된 버전)
⚔️ 공격 벡터
직접적인 공격보다는 시스템 부하가 높은 환경에서 자연적으로 발생하거나, 많은 수의 스레드를 생성하여 유도할 수 있음
🛡️ 대응 방법
kmemleak 스캔 시 태스크별로 RCU 락을 분리하고 재스케줄링이 가능하도록 수정된 최신 커널 패치를 적용하십시오.
🔧 검증 코드
출력된 커널 버전이 해당 패치가 적용된 최신 버전인지 확인하십시오.