5.5medium
sched_ext: Fix stale direct dispatch state in ddsp_dsq_id
- Severity
- 5.5medium CVSS:3.1 by NVD
- Exploit likelihood
- 0.14% (higher than 3% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
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().
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 5b26f7b920f76b2b9cc398c252a9e35e44bf5bb9 before ca685511f7afd42cdcbb0feea42e5d332d384251, from 5b26f7b920f76b2b9cc398c252a9e35e44bf5bb9 before 5e7b2cc8fae9ec2a5bc53311191d2faaff75a4b5, from 5b26f7b920f76b2b9cc398c252a9e35e44bf5bb9 before 7ea601daa0153e19cd1c6e6b300348c70c05fe77, from 5b26f7b920f76b2b9cc398c252a9e35e44bf5bb9 before 7e0ffb72de8aa3b25989c2d980e81b829c577010, 6.12 Not affected: before 6.12, from 6.12.82 up to 6.12.*, from 6.18.22 up to 6.18.*, from 6.19.12 up to 6.19.*, from 7.0 up to * | CVE List |
| linux linux_kernel | from 6.12 before 6.12.82, from 6.13 before 6.18.22, from 6.19 before 6.19.12, 7.0 | NVD |
What each source says
CVE List
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().
NVD (es)
En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: sched_ext: Corrige el estado obsoleto de despacho directo en ddsp_dsq_id @p -> scx.ddsp_dsq_id puede quedar establecido (no-SCX_DSQ_INVALID) desencadenando una advertencia espuria en mark_direct_dispatch() cuando el ops.select_cpu() de la siguiente activación llama a scx_bpf_dsq_insert(), como por ejemplo: ADVERTENCIA: kernel/sched/ext.c:1273 en scx_dsq_insert_commit+0xcd/0x140 La causa raíz es que ddsp_dsq_id solo se borraba en dispatch_enqueue(), que no se alcanza en todas las rutas que consumen o cancelan un veredicto de despacho directo. Corrígelo borrándolo en los lugares correctos: - direct_dispatch(): almacena en caché el estado de despacho directo en variables locales y bórralo antes de dispatch_enqueue() en la ruta síncrona. Para la ruta diferida, el estado de despacho directo debe permanecer establecido hasta que process_ddsp_deferred_locals() los consuma. - process_ddsp_deferred_locals(): almacena en caché el estado de despacho en variables locales y bórralo antes de llamar a dispatch_to_local_dsq(), lo que puede migrar la tarea a otra rq. - do_enqueue_task(): borra el estado de despacho en la ruta de encolamiento (alternativas local/global/bypass), donde el veredicto de despacho directo es ignorado. - dequeue_task_scx(): borra el estado de despacho después de dispatch_dequeue() para manejar tanto la cancelación de despacho diferido como la condición de carrera holding_cpu, cubriendo todos los casos en los que se cancela un despacho directo pendiente. - scx_disable_task(): borra el estado de despacho directo al hacer la transición de una tarea fuera del planificador actual. Las tareas que se activan pueden haber tenido el estado de despacho directo establecido por el ops.select_cpu() del planificador saliente y luego haber sido encoladas en una wake_list a través de ttwu_queue_wakelist(), cuando SCX_OPS_ALLOW_QUEUED_WAKEUP está establecido. Dichas tareas no están en la runqueue y no son iteradas por scx_bypass(), por lo que su estado de despacho directo no se borrará. Sin este borrado, cualquier planificador SCX subsiguiente que intente despachar directamente la tarea activará el WARN_ON_ONCE() en mark_direct_dispatch().
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-31733 changed 2026-05-11 | CVE Terms of Use |
| NVD | CVE-2026-31733 changed 2026-11-11 | Public domain |