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 <[email protected]>
> Cc: Oleg Nesterov <[email protected]>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>

For workqueue part,

 Acked-by: Tejun Heo <[email protected]>

Please route anyway you see fit.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to