В ядре Linux устранена следующая уязвимость:
sched_ext: исправлено устаревшее состояние прямой отправки в ddsp_dsq_id.
@p->scx.ddsp_dsq_id можно оставить установленным (не SCX_DSQ_INVALID), запуская
ложное предупреждение в mark_direct_dispatch() при следующем пробуждении
ops.select_cpu() вызывает scx_bpf_dsq_insert(), например:
ВНИМАНИЕ: kernel/sched/ext.c:1273 по адресу scx_dsq_insert_commit+0xcd/0x140. Основная причина в том, что ddsp_dsq_id очищался только в send_enqueue(),
который не достигается на всех путях, которые используют или отменяют прямую отправку
вердикт. Исправьте это, очистив его в нужных местах:
- Direct_dispatch(): кэширует состояние прямой отправки в локальных переменных.
и очистите его перед диспетчеризацией_enqueue() на синхронном пути.
Для
отложенный путь, состояние прямой отправки должно оставаться установленным до тех пор, пока
их использует процесс_ddsp_deferred_locals().
-process_ddsp_deferred_locals(): кэширует состояние отправки локально.
переменные и очистите их перед вызовом send_to_local_dsq(), который
может перенести задачу на другой клиент.
- do_enqueue_task(): очистить состояние отправки на пути постановки в очередь
(локальные/глобальные/обходные резервные варианты), где вердикт прямой отправки
игнорируется.
- dequeue_task_scx(): очистить состояние отправки после send_dequeue()
для обработки как отмены отложенной отправки, так и Holding_cpu
гонка, охватывающая все случаи, когда ожидающая прямая отправка
отменен.
- scx_disable_task(): очищает состояние прямой отправки, когда
перенос задачи из текущего планировщика. Задачи бодрствования могут
имели состояние прямой отправки, установленное исходящим планировщиком
ops.select_cpu(), а затем был поставлен в очередь в Wake_list через
ttwu_queue_wakelist(), когда установлен SCX_OPS_ALLOW_QUEUED_WAKEUP. такой
задачи не находятся в очереди выполнения и не выполняются scx_bypass(),
поэтому их состояние прямой отправки не будет очищено. Без этого понятно,
любой последующий планировщик SCX, который пытается напрямую отправить задачу
вызовет WARN_ON_ONCE() в mark_direct_dispatch().
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: sched_ext: Fix stale direct dispatch state in ddsp_dsq_id @p->scx.ddsp_dsq_id can be left set (non-SCX_DSQ_INVALID) triggering a spurious warning in mark_direct_dispatch() when the next wakeup's ops.select_cpu() calls scx_bpf_dsq_insert(), such as: WARNING: kernel/sched/ext.c:1273 at scx_dsq_insert_commit+0xcd/0x140 The root cause is that ddsp_dsq_id was only cleared in dispatch_enqueue(), which is not reached in all paths that consume or cancel a direct dispatch verdict. Fix it by clearing it at the right places: - direct_dispatch(): cache the direct dispatch state in local variables and clear it before dispatch_enqueue() on the synchronous path. For the deferred path, the direct dispatch state must remain set until process_ddsp_deferred_locals() consumes them. - process_ddsp_deferred_locals(): cache the dispatch state in local variables and clear it before calling dispatch_to_local_dsq(), which may migrate the task to another rq. - do_enqueue_task(): clear the dispatch state on the enqueue path (local/global/bypass fallbacks), where the direct dispatch verdict is ignored. - dequeue_task_scx(): clear the dispatch state after dispatch_dequeue() to handle both the deferred dispatch cancellation and the holding_cpu race, covering all cases where a pending direct dispatch is cancelled. - scx_disable_task(): clear the direct dispatch state when transitioning a task out of the current scheduler. Waking tasks may have had the direct dispatch state set by the outgoing scheduler's ops.select_cpu() and then been queued on a wake_list via ttwu_queue_wakelist(), when SCX_OPS_ALLOW_QUEUED_WAKEUP is set. Such tasks are not on the runqueue and are not iterated by scx_bypass(), so their direct dispatch state won't be cleared. Without this clear, any subsequent SCX scheduler that tries to direct dispatch the task will trigger the WARN_ON_ONCE() in mark_direct_dispatch().
Характеристики атаки
Последствия
Строка CVSS v3.1
Уязвимые продукты 9
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.12
|
6.12.82
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.18.22
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
6.19.12
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc5:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc6:*:*:*:*:*:*
|
— | — |