summaryrefslogtreecommitdiff
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2015-05-15 17:43:34 +0200
committerAmit Pundir <amit.pundir@linaro.org>2016-09-14 15:02:22 +0530
commit2748928f860f549290b2c7299dc16ce8855019cf (patch)
treee4c2afb7b618603742a3db20343d3d1c43d5901f /security/selinux/hooks.c
parentbfa1dd2bfda910b60e425974fd5dc94a6bdaccc4 (diff)
UPSTREAM: sched: Fix a race between __kthread_bind() and sched_setaffinity()
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 bug by putting everything under the regular scheduler locks. This also closes a hole in the serialization of task_struct::{nr_,}cpus_allowed. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Tejun Heo <tj@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: dedekind1@gmail.com Cc: juri.lelli@arm.com Cc: mgorman@suse.de Cc: riel@redhat.com Cc: rostedt@goodmis.org Link: http://lkml.kernel.org/r/20150515154833.545640346@infradead.org Signed-off-by: Ingo Molnar <mingo@kernel.org> (cherry picked from commit 25834c73f93af7f0712c98ca4593691592e6b360) Signed-off-by: Punit Agrawal <punit.agrawal@arm.com> BUG=chrome-os-partner:44828 TEST=Boot kernel on Oak. TEST=smaug-release and strago-release trybots. Change-Id: Id3c898c5ee1a22ed704e83f2ecf5f78199280d38 Reviewed-on: https://chromium-review.googlesource.com/321264 Commit-Ready: Ricky Liang <jcliang@chromium.org> Tested-by: Ricky Liang <jcliang@chromium.org> Reviewed-by: Ricky Liang <jcliang@chromium.org> Conflicts: kernel/sched/core.c
Diffstat (limited to 'security/selinux/hooks.c')
0 files changed, 0 insertions, 0 deletions