🇰🇷 한글 설명
Linux 커널의 스케줄러 캐시 그룹링 기능에서 sched_cache_stat이 mm_struct에 묶여 있어, 태스크가 mm을 전환하는 동안 다른 CPU의 account_mm_sched()가 이미 해제된 이전 mm에 접근하는 Use-After-Free 문제가 발생합니다. 이를 해결하기 위해 sched_cache_group을 mm_struct에서 분리하고 자체 참조 카운팅으로 수명을 관리하도록 수정되었습니다.
💡 쉬운 설명
컴퓨터 운영체제 내부에서 프로그램이 이미 지워진 메모리를 잘못 읽을 수 있는 버그입니다. 이 문제는 통계 정보의 수명 관리를 분리하여 해결되었습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
sched/cache: Decouple sched_cache_group from mm to fix UAF
Currently the sched cache grouping is by mm and the scheduling statistics
sched_cache_stat lives in the mm structure. This ties the life cycle
of scheduling stats with mm.
In account_mm_sched(), the scheduling stats are accessed by
task->mm->sc_stat. However, a task may be switching mm on one CPU when
another CPU is running account_mm_sched(), and possibly accessing the
old mm that was freed. This problem was found when running tests with
KASAN by Hyunwoo:
https://lore.kernel.org/lkml/apPb-Dr4nPYuHQOK@v4bel/
Instead of serializing the mm access by introducing extra acquisition of
rq lock in the mm free path, extract sched_cache_stat from mm_struct,
rename it as sched_cache_group and manage its life cycle apart from
mm_struct with its own ref counting. This allows us in the next patch
access sched_cache_group directly from task, and add a refcount
on sched_cache_group when a task links to it. This prevents the use
after free issue when accessing stale and released old mm and its
sched cache stat a task switches to a new mm while account_mm_sched()
is done elsewhere.
The other benefit of this restructure is in the future, the grouping of
tasks to a LLC would have the flexibility to be associated with a user
defined grouping, or cgroup, cookie group, numa_group or others instead
of just with a single mm address space.
Rename sched_cache_stat to sched_cache_group and turn it into a refcounted
object allocated from mm_struct. The mm_struct now holds a pointer
(sched_cache_grp) to this object instead of embedding it.
📍 영향받는 시스템
sched_cache 기능이 포함된 Linux 커널 (수정 커밋 적용 전 버전)
⚔️ 공격 벡터
로컬 사용자가 태스크의 mm 전환과 스케줄러 통계 접근 타이밍을 조작해 해제된 메모리를 참조하도록 유도하여 커널 메모리 손상 또는 권한 상승을 시도할 수 있습니다.
🛡️ 대응 방법
수정 패치가 포함된 최신 Linux 커널 버전으로 업데이트하고 재부팅하십시오.
🔧 검증 코드
출력된 커널 버전을 배포판 보안 공지에서 해당 CVE 수정 버전과 비교하여, 수정된 버전 이상이면 패치가 적용된 것이고 미만이면 업데이트가 필요합니다.