🇰🇷 한글 설명
Linux 커널의 sched_ext 구성 요소에서 코어 스케줄링 중 rq->core_pick 데이터가 손상되는 취약점이 발견되었습니다. 이로 인해 NULL 포인터 역참조가 발생하거나 잘못된 작업 선택으로 인해 시스템 데드락 및 하드 행(Hard Hang)이 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터의 두뇌 역할을 하는 커널이 여러 작업을 동시에 처리하는 과정에서 데이터가 꼬여 시스템이 멈추거나 오류가 발생하는 문제입니다. 특히 특정 부하가 걸리는 상황에서 시스템이 완전히 먹통이 될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
sched_ext: Fix rq->core_pick corruption under core scheduling
Core scheduling's pick_next_task() picks what to run on every SMT sibling of
the core in a single pass under the shared core-wide rq lock. The selection
state is consistent only while the lock is held continuously, so
->pick_task() originally could not release it. However, since 4c95380701f5
("sched/ext: Fold balance_scx() into pick_task_scx()"), sched_ext runs
dispatch from inside the pick and dispatching can drop the rq lock. To
support this, pick_next_task() has been updated to restart the whole
selection when a pick returns RETRY_TASK after releasing the lock.
When selections on the same core interleave through the dropped lock, they
corrupt each other's state: one clears the other's rq->core_pick leading to
a NULL deref, or invalidates its keep-the-previous-task decision leaving a
dequeued task running, which deadlocks the next wakeup and matches the
reported hard hangs. A cookied ping-pong load on an SMT machine makes the
interleavings frequent and kills the kernel within seconds.
Fix it by making the pick return RETRY_TASK whenever dispatch released the
rq lock, so that a selection only ever commits picks made under a
continuously held lock. The previous patch's rq->scx.lock_drop_seq counts
the releases. A dispatch that touched nothing never releases the lock and
its verdict, including "nothing to run", stands: retries are bounded, each
following a dispatch that actually did something, and an idle CPU does not
loop.
If another dispatch is already in flight on the rq, skip dispatching and
pick from what is already queued locally - the in-flight dispatch has
released the lock, so its own selection will retry and re-pick this rq,
while returning RETRY_TASK here would only spin on the lock that dispatch
needs to finish.
Balance callbacks must run in the context that queued them, so they can only
be queued on the CPU's own rq. When dispatching for another rq, run the
deferred work directly instead - that rq may consume all its picks through
the core-sched fast path and never queue the callback itself.
The put_prev_task_scx() warning about a runnable task being left behind
assumed that dispatch ran as part of the very pick that is switching away.
That now only holds on the non-core path, so gate it and drop the
cookie-match test, which is always true without core scheduling, from its
condition.
📍 영향받는 시스템
sched_ext 기능이 활성화된 Linux 커널 (특정 커밋 4c95380701f5 이후 버전 포함)
⚔️ 공격 벡터
SMT(동시 다중 스레딩) 환경에서 특정 부하(Ping-pong load)를 유발하여 커널의 스케줄링 로직을 교란함
🛡️ 대응 방법
sched_ext 관련 수정 패치가 적용된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인합니다.