lkml.org 
[lkml]   [2015]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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


    \
     
     \ /
      Last update: 2015-05-15 19:01    [W:4.688 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site