]> git.baikalelectronics.ru Git - kernel.git/commit
sched: Fix affine_move_task() self-concurrency
authorPeter Zijlstra <peterz@infradead.org>
Wed, 24 Feb 2021 10:31:09 +0000 (11:31 +0100)
committerIngo Molnar <mingo@kernel.org>
Sat, 6 Mar 2021 11:40:21 +0000 (12:40 +0100)
commit27f9429eb94f7c96959248cc79d51099f4cf11df
treee2b33a0421643459bbedd3333ac6f8264380aef7
parentc5350b8d1dbcc9dc30f96e473c5f0a406579623a
sched: Fix affine_move_task() self-concurrency

Consider:

   sched_setaffinity(p, X); sched_setaffinity(p, Y);

Then the first will install p->migration_pending = &my_pending; and
issue stop_one_cpu_nowait(pending); and the second one will read
p->migration_pending and _also_ issue: stop_one_cpu_nowait(pending),
the _SAME_ @pending.

This causes stopper list corruption.

Add set_affinity_pending::stop_pending, to indicate if a stopper is in
progress.

Fixes: 608f0244d486 ("sched: Fix migrate_disable() vs set_cpus_allowed_ptr()")
Cc: stable@kernel.org
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lkml.kernel.org/r/20210224131355.649146419@infradead.org
kernel/sched/core.c