| From bippy-5f407fcff5a0 Mon Sep 17 00:00:00 2001 |
| From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| To: <linux-cve-announce@vger.kernel.org> |
| Reply-to: <cve@kernel.org>, <linux-kernel@vger.kernel.org> |
| Subject: CVE-2024-50263: fork: only invoke khugepaged, ksm hooks if no error |
| |
| Description |
| =========== |
| |
| In the Linux kernel, the following vulnerability has been resolved: |
| |
| fork: only invoke khugepaged, ksm hooks if no error |
| |
| There is no reason to invoke these hooks early against an mm that is in an |
| incomplete state. |
| |
| The change in commit d24062914837 ("fork: use __mt_dup() to duplicate |
| maple tree in dup_mmap()") makes this more pertinent as we may be in a |
| state where entries in the maple tree are not yet consistent. |
| |
| Their placement early in dup_mmap() only appears to have been meaningful |
| for early error checking, and since functionally it'd require a very small |
| allocation to fail (in practice 'too small to fail') that'd only occur in |
| the most dire circumstances, meaning the fork would fail or be OOM'd in |
| any case. |
| |
| Since both khugepaged and KSM tracking are there to provide optimisations |
| to memory performance rather than critical functionality, it doesn't |
| really matter all that much if, under such dire memory pressure, we fail |
| to register an mm with these. |
| |
| As a result, we follow the example of commit d2081b2bf819 ("mm: |
| khugepaged: make khugepaged_enter() void function") and make ksm_fork() a |
| void function also. |
| |
| We only expose the mm to these functions once we are done with them and |
| only if no error occurred in the fork operation. |
| |
| The Linux kernel CVE team has assigned CVE-2024-50263 to this issue. |
| |
| |
| Affected and fixed versions |
| =========================== |
| |
| Issue introduced in 6.8 with commit d2406291483775ecddaee929231a39c70c08fda2 and fixed in 6.11.7 with commit 3b85aa0da8cd01173b9afd1f70080fbb9576c4b0 |
| Issue introduced in 6.8 with commit d2406291483775ecddaee929231a39c70c08fda2 and fixed in 6.12 with commit 985da552a98e27096444508ce5d853244019111f |
| |
| 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-50263 |
| 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/ksm.h |
| kernel/fork.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/3b85aa0da8cd01173b9afd1f70080fbb9576c4b0 |
| https://git.kernel.org/stable/c/985da552a98e27096444508ce5d853244019111f |
| https://project-zero.issues.chromium.org/issues/373391951 |