🇰🇷 한글 설명
리눅스 커널의 메모리 관리(mm) 서브시스템 내 shrinker 메커니즘에서 발생하는 레이스 컨디션 취약점입니다. shrinker_info를 해제하는 과정이 적절한 뮤텍스 잠금 없이 수행되어, 동시에 다른 프로세스가 해당 정보에 접근할 경우 Use-After-Free 또는 Double-Free 오류가 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터가 메모리를 정리하는 과정에서 두 가지 작업이 동시에 일어나 충돌이 발생하는 문제입니다. 이로 인해 시스템이 갑자기 멈추거나 보안상 위험한 상태가 될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm: shrinker: fix shrinker_info teardown race with expansion
expand_shrinker_info() iterates all visible memcgs under shrinker_mutex,
including memcgs that have not finished ->css_online() yet.
Once pn->shrinker_info has been published, teardown must stay serialized
with expand_shrinker_info() until that memcg is either fully online or no
longer visible to iteration. Today alloc_shrinker_info() breaks that rule
by dropping shrinker_mutex before freeing a partially initialized
shrinker_info array, which may cause the following race:
CPU0 CPU1
==== ====
css_create
--> list_add_tail_rcu(&css->sibling, &parent_css->children);
online_css
--> mem_cgroup_css_online
--> alloc_shrinker_info
--> alloc node0 info
rcu_assign_pointer(C->node0->shrinker_info, old0)
alloc node1 info -> FAIL -> goto err
mutex_unlock(shrinker_mutex)
shrinker_alloc()
--> shrinker_memcg_alloc
--> mutex_lock(shrinker_mutex)
expand_shrinker_info
--> mem_cgroup_iter see the memcg
expand_one_shrinker_info
--> old0 = C->node0->shrinker_info
memcpy(new->unit, old0->unit, ...);
free_shrinker_info
--> kvfree(old0);
/* double free !! */
kvfree_rcu(old0, rcu);
The same problem exists later in mem_cgroup_css_online(). If
alloc_shrinker_info() succeeds but a subsequent objcg allocation fails,
the free_objcg -> free_shrinker_info() unwind path tears down the already
published pn->shrinker_info arrays without shrinker_mutex. The
expand_one_shrinker_info() can race with that teardown in the same way,
leading to use-after-free or double-free of the old shrinker_info.
Fix this by serializing shrinker_info teardown with shrinker_mutex, and by
keeping alloc_shrinker_info() error cleanup inside the locked section.
📍 영향받는 시스템
Linux Kernel (shrinker_info 관련 메모리 관리 모듈이 포함된 버전)
⚔️ 공격 벡터
로컬 공격자가 메모리 할당/해제 과정을 정밀하게 조작하여 레이스 컨디션을 유도함으로써 커널 권한 획득 또는 DoS 공격 수행
🛡️ 대응 방법
리눅스 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 shrinker_info 해제 시 뮤텍스 잠금을 강제하도록 수정해야 합니다.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 릴리즈 노트를 통해 대조합니다.