]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
sched: Fix yet more sched_fork() races
authorPeter Zijlstra <peterz@infradead.org>
Mon, 14 Feb 2022 09:16:57 +0000 (10:16 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Wed, 9 Mar 2022 14:17:55 +0000 (15:17 +0100)
commit65bd0eb6287f5978fd273e383347d22cba860066
tree5314ddcb14500247b3fb4c9e288084f67dc6fa40
parentb211085d11eb92f4c21cf905bd979ce980fd95b6
sched: Fix yet more sched_fork() races

BugLink: https://bugs.launchpad.net/bugs/1964361
commit b1e8206582f9d680cff7d04828708c8b6ab32957 upstream.

Where commit 4ef0c5c6b5ba ("kernel/sched: Fix sched_fork() access an
invalid sched_task_group") fixed a fork race vs cgroup, it opened up a
race vs syscalls by not placing the task on the runqueue before it
gets exposed through the pidhash.

Commit 13765de8148f ("sched/fair: Fix fault in reweight_entity") is
trying to fix a single instance of this, instead fix the whole class
of issues, effectively reverting this commit.

Fixes: 4ef0c5c6b5ba ("kernel/sched: Fix sched_fork() access an invalid sched_task_group")
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Tested-by: Zhang Qiao <zhangqiao22@huawei.com>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Link: https://lkml.kernel.org/r/YgoeCbwj5mbCR0qA@hirez.programming.kicks-ass.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
include/linux/sched/task.h
kernel/fork.c
kernel/sched/core.c