Messages in this thread | | | Date | Fri, 15 May 2015 11:56:53 -0400 | From | Tejun Heo <> | Subject | Re: [RFC][PATCH 1/4] sched: Fix a race between __kthread_bind() and sched_setaffinity() |
| |
On Fri, May 15, 2015 at 05:43:34PM +0200, Peter Zijlstra wrote: > Because sched_setscheduler() checks p->flags & PF_NO_SETAFFINITY > without locks, a caller might observe an old value and race with the > set_cpus_allowed_ptr() call from __kthread_bind() and effectively undo > it. > > __kthread_bind() > do_set_cpus_allowed() > <SYSCALL> > sched_setaffinity() > if (p->flags & PF_NO_SETAFFINITIY) > set_cpus_allowed_ptr() > p->flags |= PF_NO_SETAFFINITY > > Fix the issue by putting everything under the regular scheduler locks. > > This also closes a hole in the serialization of > task_struct::{nr_,}cpus_allowed. > > Cc: Tejun Heo <tj@kernel.org> > Cc: Oleg Nesterov <oleg@redhat.com> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
For workqueue part,
Acked-by: Tejun Heo <tj@kernel.org>
Please route anyway you see fit.
Thanks.
-- tejun
| |