CVE-2024-42312: sysctl: always initialize i_uid/i_gid
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
sysctl: always initialize i_uid/i_gid
Always initialize i_uid/i_gid inside the sysfs core so set_ownership() can safely skip setting them.
Commit 5ec27ec735ba ("fs/proc/proc_sysctl.c: fix the default values of i_uid/i_gid on /proc/sys inodes.") added defaults for i_uid/i_gid when set_ownership() was not implemented. It also missed adjusting net_ctl_set_ownership() to use the same default values in case the computation of a better value failed.
The Linux kernel CVE team has assigned CVE-2024-42312 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.3 with commit 5ec27ec735ba and fixed in 6.1.104 with commit 1deae34db9f4 Issue introduced in 5.3 with commit 5ec27ec735ba and fixed in 6.6.45 with commit ffde3af4b29b Issue introduced in 5.3 with commit 5ec27ec735ba and fixed in 6.10.3 with commit c7e2f43d182f Issue introduced in 5.3 with commit 5ec27ec735ba and fixed in 6.11-rc1 with commit 98ca62ba9e2b Issue introduced in 4.9.187 with commit e83234d7ef23
Issue introduced in 4.14.135 with commit 2cbf2af144f0
Issue introduced in 4.19.61 with commit 2c7b50c7b1d0
Issue introduced in 5.1.20 with commit 7eb45a94c279
Issue introduced in 5.2.3 with commit 14cc90952cef
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-2024-42312
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:
fs/proc/proc_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/1deae34db9f4f8e0e03f891be2e2e15c15c8ac05 https://git.kernel.org/stable/c/ffde3af4b29bf97d62d82e1d45275587e10a991a https://git.kernel.org/stable/c/c7e2f43d182f5dde473389dbb39f16c9f0d64536 https://git.kernel.org/stable/c/98ca62ba9e2be5863c7d069f84f7166b45a5b2f4