🇰🇷 한글 설명
Linux 커널의 SCHED_DEADLINE 스케줄러에서 우선순위 상속(PI) 과정 중 ENQUEUE_REPLENISH 플래그가 누락되는 취약점입니다. 이로 인해 작업의 우선순위가 변경될 때 대역폭 계산(bandwidth accounting)이 손상되어 시스템의 실시간 스케줄링 동작에 오류가 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터가 중요한 작업을 처리할 때 우선순위를 조절하는 과정에서 계산 실수가 발생하는 문제입니다. 이 오류로 인해 시스템이 작업의 중요도를 잘못 판단하여 실시간 성능이 떨어질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
sched/deadline: Fix missing ENQUEUE_REPLENISH during PI de-boosting
Running stress-ng --schedpolicy 0 on an RT kernel on a big machine
might lead to the following WARNINGs (edited).
sched: DL de-boosted task PID 22725: REPLENISH flag missing
WARNING: CPU: 93 PID: 0 at kernel/sched/deadline.c:239 dequeue_task_dl+0x15c/0x1f8
... (running_bw underflow)
Call trace:
dequeue_task_dl+0x15c/0x1f8 (P)
dequeue_task+0x80/0x168
deactivate_task+0x24/0x50
push_dl_task+0x264/0x2e0
dl_task_timer+0x1b0/0x228
__hrtimer_run_queues+0x188/0x378
hrtimer_interrupt+0xfc/0x260
...
The problem is that when a SCHED_DEADLINE task (lock holder) is
changed to a lower priority class via sched_setscheduler(), it may
fail to properly inherit the parameters of potential DEADLINE donors
if it didn't already inherit them in the past (shorter deadline than
donor's at that time). This might lead to bandwidth accounting
corruption, as enqueue_task_dl() won't recognize the lock holder as
boosted.
The scenario occurs when:
1. A DEADLINE task (donor) blocks on a PI mutex held by another
DEADLINE task (holder), but the holder doesn't inherit parameters
(e.g., it already has a shorter deadline)
2. sched_setscheduler() changes the holder from DEADLINE to a lower
class while still holding the mutex
3. The holder should now inherit DEADLINE parameters from the donor
and be enqueued with ENQUEUE_REPLENISH, but this doesn't happen
Fix the issue by introducing __setscheduler_dl_pi(), which detects when
a DEADLINE (proper or boosted) task gets setscheduled to a lower
priority class. In case, the function makes the task inherit DEADLINE
parameters of the donoer (pi_se) and sets ENQUEUE_REPLENISH flag to
ensure proper bandwidth accounting during the next enqueue operation.
📍 영향받는 시스템
Linux kernel (SCHED_DEADLINE 기능을 사용하는 RT 커널 환경)
⚔️ 공격 벡터
특정 스케줄링 조건(SCHED_DEADLINE 작업의 우선순위 변경 및 뮤텍스 점유)을 유도하여 커널 대역폭 계산 오류 유발
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 __setscheduler_dl_pi() 수정 사항 반영
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인