Skip to main content

CVE-2024-35797: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2024-35797cvecve-2024-35797
Published: Fri May 17 2024 (05/17/2024, 13:23:08 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: mm: cachestat: fix two shmem bugs When cachestat on shmem races with swapping and invalidation, there are two possible bugs: 1) A swapin error can have resulted in a poisoned swap entry in the shmem inode's xarray. Calling get_shadow_from_swap_cache() on it will result in an out-of-bounds access to swapper_spaces[]. Validate the entry with non_swap_entry() before going further. 2) When we find a valid swap entry in the shmem's inode, the shadow entry in the swapcache might not exist yet: swap IO is still in progress and we're before __remove_mapping; swapin, invalidation, or swapoff have removed the shadow from swapcache after we saw the shmem swap entry. This will send a NULL to workingset_test_recent(). The latter purely operates on pointer bits, so it won't crash - node 0, memcg ID 0, eviction timestamp 0, etc. are all valid inputs - but it's a bogus test. In theory that could result in a false "recently evicted" count. Such a false positive wouldn't be the end of the world. But for code clarity and (future) robustness, be explicit about this case. Bail on get_shadow_from_swap_cache() returning NULL.

AI-Powered Analysis

AILast updated: 06/29/2025, 15:57:04 UTC

Technical Analysis

CVE-2024-35797 is a medium-severity vulnerability in the Linux kernel's memory management subsystem, specifically related to the cachestat feature and its handling of shared memory (shmem) swap entries. The flaw arises from race conditions between cachestat operations and swap or invalidation processes. Two primary bugs were identified: first, a swapin error can cause a poisoned swap entry in the shmem inode's xarray, which leads to an out-of-bounds access when get_shadow_from_swap_cache() is called. This is mitigated by validating entries with non_swap_entry() before further processing. Second, a valid swap entry in the shmem inode may reference a shadow entry in the swapcache that does not yet exist due to ongoing swap IO or recent removal by swapin, invalidation, or swapoff operations. This results in get_shadow_from_swap_cache() returning NULL, which causes workingset_test_recent() to operate on a NULL pointer. Although this does not cause a crash due to the function's pointer bit operations, it can produce false "recently evicted" counts, potentially misleading memory management decisions. The patch explicitly handles the NULL case to improve code clarity and robustness. The vulnerability is classified under CWE-787 (Out-of-bounds Write), and has a CVSS 3.1 score of 5.3, indicating a medium severity with network attack vector, low attack complexity, no privileges required, and no user interaction needed. No known exploits are reported in the wild as of publication. This vulnerability affects Linux kernel versions identified by the commit hash cf264e1329fb0307e044f7675849f9f38b44c11a and likely related versions around that code state. The issue primarily impacts kernel memory management reliability and could lead to denial of service or degraded system performance due to corrupted memory accounting or management data structures.

Potential Impact

For European organizations, the impact of CVE-2024-35797 centers on potential system instability or denial of service conditions on Linux-based infrastructure. Since Linux is widely deployed in servers, cloud environments, and embedded systems across Europe, this vulnerability could affect critical services if exploited or triggered inadvertently. The out-of-bounds access and corrupted memory accounting could lead to unpredictable behavior in memory management, possibly causing crashes or degraded performance. Although no direct confidentiality or integrity compromise is indicated, availability could be impacted, especially in environments with high memory pressure or heavy use of shared memory and swapping. This is particularly relevant for data centers, cloud providers, and enterprises relying on Linux for critical workloads. The absence of required privileges or user interaction means that remote exploitation is theoretically possible if an attacker can induce the vulnerable conditions, increasing risk in exposed environments. However, the lack of known exploits and the medium severity score suggest that immediate widespread impact is limited but should not be ignored. Timely patching is essential to maintain system stability and prevent potential denial of service scenarios.

Mitigation Recommendations

European organizations should prioritize updating their Linux kernel to the patched versions that address CVE-2024-35797 as soon as vendor updates are available. Since this vulnerability involves kernel memory management internals, applying official kernel patches or upgrading to the latest stable kernel releases is the most effective mitigation. Organizations should also audit their systems for kernel versions matching or close to the affected commit hash and plan coordinated patch management. In environments where immediate patching is not feasible, monitoring system logs and kernel messages for anomalies related to swap or memory management could provide early warning signs. Additionally, limiting exposure of vulnerable systems by restricting network access and employing robust network segmentation can reduce the risk of remote exploitation. For cloud and containerized environments, ensuring that underlying host kernels are patched is critical, as container workloads share the host kernel. Finally, organizations should maintain up-to-date backups and incident response plans to quickly recover from potential denial of service events caused by this or related kernel issues.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-05-17T12:19:12.340Z
Cisa Enriched
true
Cvss Version
3.1
State
PUBLISHED

Threat ID: 682d982ac4522896dcbe34d8

Added to database: 5/21/2025, 9:08:58 AM

Last enriched: 6/29/2025, 3:57:04 PM

Last updated: 7/28/2025, 8:39:25 PM

Views: 8

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats