🇰🇷 한글 설명
Linux 커널의 migrate_pages_batch() 함수에서 대량의 페이지를 이동할 때 RCU-tasks 정지 상태를 제대로 보고하지 않는 취약점이 발견되었습니다. 이로 인해 kcompactd와 같은 프로세스가 RCU grace period를 지연시켜 시스템 전체의 성능 저하를 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터가 메모리를 정리하는 과정에서 너무 오랫동안 한 가지 작업에만 매달려 다른 중요한 시스템 작업들을 멈추게 만드는 문제입니다. 이로 인해 시스템이 일시적으로 느려지거나 멈추는 현상이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm/migrate: report RCU-tasks quiescent states in migrate_pages_batch()
migrate_pages_batch() unmaps each folio before moving it, and every
unmap runs the mmu_notifier invalidate callbacks. On KVM hosts
try_to_migrate() ends up in kvm_mmu_notifier_invalidate_range_start() ->
tdp_mmu_zap_leafs(), which is expensive, so unmapping a large batch keeps
the CPU busy for a long time.
The loop already calls cond_resched(), but on PREEMPTION kernels that is
a no-op, and involuntary preemption is not a Tasks-RCU quiescent state.
A long batch therefore never reports a quiescent state, and the
migrating task (e.g. kcompactd) becomes a Tasks-RCU holdout, stalling the
Tasks-RCU grace period for minutes, which is common at Meta fleet:
INFO: rcu_tasks detected stalls on tasks:
0000000055349ecc: .. nvcsw: 1157401/1157401 holdout: 1 idle_cpu: -1/56 task:kcompactd0 state:R running task
Call Trace:
tdp_mmu_zap_leafs
tdp_mmu_next_root
gfn_to_pfn_cache_invalidate_start
kvm_mmu_notifier_invalidate_range_start
__mmu_notifier_invalidate_range_start
try_to_migrate_one
try_to_migrate
migrate_pages_batch
migrate_pages
compact_zone
compact_node
kcompactd
kthread
Use cond_resched_tasks_rcu_qs() so a quiescent state is reported even
when cond_resched() does nothing.
This has also been discussed at [1]
📍 영향받는 시스템
Linux kernel (KVM 호스트 환경에서 특히 영향)
⚔️ 공격 벡터
직접적인 외부 공격보다는 대량의 메모리 페이지 이동을 유도하는 작업(메모리 압축 등)을 통해 시스템 성능 저하 유발 가능
🛡️ 대응 방법
커널 패치를 적용하여 migrate_pages_batch() 내에서 cond_resched_tasks_rcu_qs()를 사용하도록 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 최신 패치 버전인지 확인