Subject: CVE-2022-48944: sched: Fix yet more sched_fork() races

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

sched: Fix yet more sched_fork() races

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.

The Linux kernel CVE team has assigned CVE-2022-48944 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.15.3 with commit 3869eecf0504 and fixed in 5.15.27 with commit 3411613611a5
	Issue introduced in 5.16 with commit 4ef0c5c6b5ba and fixed in 5.16.13 with commit c65cfd89cef6
	Issue introduced in 5.16 with commit 4ef0c5c6b5ba and fixed in 5.17 with commit b1e8206582f9
	Issue introduced in 5.10.80 with commit c85c6fadbef0
	Issue introduced in 5.14.19 with commit 25d40b828fb8

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2022-48944
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	include/linux/sched/task.h
	kernel/fork.c
	kernel/sched/core.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/3411613611a5cddf7e80908010dc87cb527dd13b
	https://git.kernel.org/stable/c/c65cfd89cef669d90c59f3bf150af6458137a04f
	https://git.kernel.org/stable/c/b1e8206582f9d680cff7d04828708c8b6ab32957