CVE-2024-35877
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
19/05/2024
Last modified:
23/12/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
x86/mm/pat: fix VM_PAT handling in COW mappings<br />
<br />
PAT handling won&#39;t do the right thing in COW mappings: the first PTE (or,<br />
in fact, all PTEs) can be replaced during write faults to point at anon<br />
folios. Reliably recovering the correct PFN and cachemode using<br />
follow_phys() from PTEs will not work in COW mappings.<br />
<br />
Using follow_phys(), we might just get the address+protection of the anon<br />
folio (which is very wrong), or fail on swap/nonswap entries, failing<br />
follow_phys() and triggering a WARN_ON_ONCE() in untrack_pfn() and<br />
track_pfn_copy(), not properly calling free_pfn_range().<br />
<br />
In free_pfn_range(), we either wouldn&#39;t call memtype_free() or would call<br />
it with the wrong range, possibly leaking memory.<br />
<br />
To fix that, let&#39;s update follow_phys() to refuse returning anon folios,<br />
and fallback to using the stored PFN inside vma->vm_pgoff for COW mappings<br />
if we run into that.<br />
<br />
We will now properly handle untrack_pfn() with COW mappings, where we<br />
don&#39;t need the cachemode. We&#39;ll have to fail fork()->track_pfn_copy() if<br />
the first page was replaced by an anon folio, though: we&#39;d have to store<br />
the cachemode in the VMA to make this work, likely growing the VMA size.<br />
<br />
For now, lets keep it simple and let track_pfn_copy() just fail in that<br />
case: it would have failed in the past with swap/nonswap entries already,<br />
and it would have done the wrong thing with anon folios.<br />
<br />
Simple reproducer to trigger the WARN_ON_ONCE() in untrack_pfn():<br />
<br />
<br />
#include <br />
#include <br />
#include <br />
#include <br />
<br />
int main(void)<br />
{<br />
struct io_uring_params p = {};<br />
int ring_fd;<br />
size_t size;<br />
char *map;<br />
<br />
ring_fd = io_uring_setup(1, &p);<br />
if (ring_fd
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 2.6.29 (including) | 4.19.312 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.20 (including) | 5.4.274 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.215 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.155 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.85 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.26 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.8.5 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.9:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/04c35ab3bdae7fefbd7c7a7355f29fa03a035221
- https://git.kernel.org/stable/c/09e6bb53217bf388a0d2fd7fb21e74ab9dffc173
- https://git.kernel.org/stable/c/1341e4b32e1fb1b0acd002ccd56f07bd32f2abc6
- https://git.kernel.org/stable/c/51b7841f3fe84606ec0bd8da859d22e05e5419ec
- https://git.kernel.org/stable/c/7cfee26d1950250b14c5cb0a37b142f3fcc6396a
- https://git.kernel.org/stable/c/97e93367e82752e475a33839a80b33bdbef1209f
- https://git.kernel.org/stable/c/c2b2430b48f3c9eaccd2c3d2ad75bb540d4952f4
- https://git.kernel.org/stable/c/f18681daaec9665a15c5e7e0f591aad5d0ac622b
- https://git.kernel.org/stable/c/04c35ab3bdae7fefbd7c7a7355f29fa03a035221
- https://git.kernel.org/stable/c/09e6bb53217bf388a0d2fd7fb21e74ab9dffc173
- https://git.kernel.org/stable/c/1341e4b32e1fb1b0acd002ccd56f07bd32f2abc6
- https://git.kernel.org/stable/c/51b7841f3fe84606ec0bd8da859d22e05e5419ec
- https://git.kernel.org/stable/c/7cfee26d1950250b14c5cb0a37b142f3fcc6396a
- https://git.kernel.org/stable/c/97e93367e82752e475a33839a80b33bdbef1209f
- https://git.kernel.org/stable/c/c2b2430b48f3c9eaccd2c3d2ad75bb540d4952f4
- https://git.kernel.org/stable/c/f18681daaec9665a15c5e7e0f591aad5d0ac622b
- https://lists.debian.org/debian-lts-announce/2024/06/msg00017.html
- https://lists.debian.org/debian-lts-announce/2024/06/msg00020.html



