Re: [PATCH sched_ext/for-6.12] sched_ext: Fix unsafe list iteration in process_ddsp_deferred_locals()

From: David Vernet
Date: Thu Aug 08 2024 - 14:21:34 EST


On Wed, Aug 07, 2024 at 10:17:38AM -1000, Tejun Heo wrote:
> process_ddsp_deferred_locals() executes deferred direct dispatches to the
> local DSQs of remote CPUs. It iterates the tasks on
> rq->scx.ddsp_deferred_locals list, removing and calling
> dispatch_to_local_dsq() on each. However, the list is protected by the rq
> lock that can be dropped by dispatch_to_local_dsq() temporarily, so the list
> can be modified during the iteration, which can lead to oopses and other
> failures.
>
> Fix it by popping from the head of the list instead of iterating the list.
>
> Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
> Fixes: 5b26f7b920f7 ("sched_ext: Allow SCX_DSQ_LOCAL_ON for direct dispatches")

Acked-by: David Vernet <void@xxxxxxxxxxxxx>

Attachment: signature.asc
Description: PGP signature