CVE-2024-35797
Severity CVSS v4.0:
Pending analysis
Type:
CWE-787
Out-of-bounds Write
Publication date:
17/05/2024
Last modified:
19/09/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
mm: cachestat: fix two shmem bugs<br />
<br />
When cachestat on shmem races with swapping and invalidation, there<br />
are two possible bugs:<br />
<br />
1) A swapin error can have resulted in a poisoned swap entry in the<br />
shmem inode&#39;s xarray. Calling get_shadow_from_swap_cache() on it<br />
will result in an out-of-bounds access to swapper_spaces[].<br />
<br />
Validate the entry with non_swap_entry() before going further.<br />
<br />
2) When we find a valid swap entry in the shmem&#39;s inode, the shadow<br />
entry in the swapcache might not exist yet: swap IO is still in<br />
progress and we&#39;re before __remove_mapping; swapin, invalidation,<br />
or swapoff have removed the shadow from swapcache after we saw the<br />
shmem swap entry.<br />
<br />
This will send a NULL to workingset_test_recent(). The latter<br />
purely operates on pointer bits, so it won&#39;t crash - node 0, memcg<br />
ID 0, eviction timestamp 0, etc. are all valid inputs - but it&#39;s a<br />
bogus test. In theory that could result in a false "recently<br />
evicted" count.<br />
<br />
Such a false positive wouldn&#39;t be the end of the world. But for<br />
code clarity and (future) robustness, be explicit about this case.<br />
<br />
Bail on get_shadow_from_swap_cache() returning NULL.
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:*:*:*:*:*:*:*:* | 6.5 (including) | 6.6.24 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.7.12 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.8 (including) | 6.8.3 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.9:rc1:*:*:*:*:*:* |
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/24a0e73d544439bb9329fbbafac44299e548a677
- https://git.kernel.org/stable/c/b79f9e1ff27c994a4c452235ba09e672ec698e23
- https://git.kernel.org/stable/c/d5d39c707a4cf0bcc84680178677b97aa2cb2627
- https://git.kernel.org/stable/c/d962f6c583458037dc7e529659b2b02b9dd3d94b
- https://git.kernel.org/stable/c/24a0e73d544439bb9329fbbafac44299e548a677
- https://git.kernel.org/stable/c/b79f9e1ff27c994a4c452235ba09e672ec698e23
- https://git.kernel.org/stable/c/d5d39c707a4cf0bcc84680178677b97aa2cb2627
- https://git.kernel.org/stable/c/d962f6c583458037dc7e529659b2b02b9dd3d94b



