🇰🇷 한글 설명
Linux 커널의 스케줄러 코드에서 task_struct가 mm_struct를 통해 캐시 그룹에 접근할 때 발생하는 Use-After-Free(UAF) 취약점이 해결되었습니다. 이를 위해 task_struct에 직접 sched_cache_grp 포인터를 도입하여 스케줄러의 핫패스 접근을 mm_struct로부터 분리하고 참조 횟수를 독립적으로 관리하도록 수정되었습니다.
💡 쉬운 설명
컴퓨터의 두뇌 역할을 하는 커널이 작업을 관리할 때, 이미 사라진 메모리 정보를 참조하여 시스템이 충돌하거나 보안 문제가 생길 수 있는 결함이 있었습니다. 이 문제를 해결하기 위해 작업 정보에 직접 연결 통로를 만들어 안전하게 정보를 확인하도록 개선했습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
sched/cache: Introduce task_struct->sched_cache_grp to fix UAF
Add a sched_cache_grp pointer to task_struct so that scheduler code
can access the cache group directly via the task, without going
through mm->sched_cache_grp. This decouples the scheduler's hot-path
accesses from the mm_struct.
Each task holds its own refcount on the sched_cache_group, separate
from the reference held by its mm_struct. The reference is acquired
in copy_mm() (fork) and exec_mmap() (exec), and released in exit_mm().
This fixes the use-after-free when account_mm_sched() reaches the group
through a task whose mm is being switched, as reported by Hyunwoo:
https://lore.kernel.org/lkml/apPb-Dr4nPYuHQOK@v4bel/
Convert all scheduler code in fair.c and exit.c to use
p->sched_cache_grp instead of p->mm->sched_cache_grp.
Keep the fork/exec/exit reference management out of the generic mm
paths: add sched_cache_fork(), sched_cache_fork_cleanup(),
sched_cache_exec_mmap() and sched_cache_exit_mm() in
kernel/sched/cache_sched.c (with empty stubs for !CONFIG_SCHED_CACHE),
so fs/exec.c, kernel/fork.c and kernel/exit.c each call one helper
instead of open-coding the refcounting under #ifdef. Also add
sched_cache_group_get() and task_cache_group_get().
📍 영향받는 시스템
Linux Kernel (sched/cache 관련 모듈을 사용하는 버전)
⚔️ 공격 벡터
메모리 관리 구조(mm_struct)가 해제되는 시점과 스케줄러가 해당 정보를 참조하는 시점 사이의 타이밍 차이를 이용한 로컬 공격
🛡️ 대응 방법
해당 패치가 적용된 최신 버전의 Linux 커널로 업데이트
🔧 검증 코드
커널 버전 확인 및 소스 코드 내 sched_cache_grp 정의 여부를 통해 패치 적용 여부를 확인합니다.
uname -a && grep -r "sched_cache_grp" /usr/src/linux-headers-$(uname -r) 2>/dev/null