[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150515155653.GA23692@htj.duckdns.org>
Date: Fri, 15 May 2015 11:56:53 -0400
From: Tejun Heo <tj@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: mingo@...nel.org, riel@...hat.com, dedekind1@...il.com,
linux-kernel@...r.kernel.org, mgorman@...e.de, rostedt@...dmis.org,
juri.lelli@....com, Oleg Nesterov <oleg@...hat.com>
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@...nel.org>
> Cc: Oleg Nesterov <oleg@...hat.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
For workqueue part,
Acked-by: Tejun Heo <tj@...nel.org>
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists