CVE-2022-49641: sysctl: Fix data races in proc_douintvec().
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
sysctl: Fix data races in proc_douintvec().
A sysctl variable is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing.
This patch changes proc_douintvec() to use READ_ONCE() and WRITE_ONCE() internally to fix data-races on the sysctl side. For now, proc_douintvec() itself is tolerant to a data-race, but we still need to add annotations on the other subsystem's side.
The Linux kernel CVE team has assigned CVE-2022-49641 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.8 with commit e7d316a02f683864a12389f8808570e37fb90aa3 and fixed in 5.10.132 with commit d5d54714e329f646bd7af4994fc427d88ee68936 Issue introduced in 4.8 with commit e7d316a02f683864a12389f8808570e37fb90aa3 and fixed in 5.15.56 with commit d335db59f7fb3353f56e52371f1ee796ae9c8f09 Issue introduced in 4.8 with commit e7d316a02f683864a12389f8808570e37fb90aa3 and fixed in 5.18.13 with commit 630c76850d554d7140232e71b5d1663e88cffb54 Issue introduced in 4.8 with commit e7d316a02f683864a12389f8808570e37fb90aa3 and fixed in 5.19 with commit 4762b532ec9539755aab61445d5da6e1926ccb99 Issue introduced in 4.4.24 with commit 70cd763eb1574cac07138be91f474a661e02d694 Issue introduced in 4.7.7 with commit f4cea51e9a3d536e2ca2b74a958f7c0b4ea733c3
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-49641
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:
kernel/sysctl.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/d5d54714e329f646bd7af4994fc427d88ee68936 https://git.kernel.org/stable/c/d335db59f7fb3353f56e52371f1ee796ae9c8f09 https://git.kernel.org/stable/c/630c76850d554d7140232e71b5d1663e88cffb54 https://git.kernel.org/stable/c/4762b532ec9539755aab61445d5da6e1926ccb99