Skip to main content

CVE-2025-22015: Vulnerability in Linux Linux

High
VulnerabilityCVE-2025-22015cvecve-2025-22015
Published: Tue Apr 08 2025 (04/08/2025, 08:18:05 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: mm/migrate: fix shmem xarray update during migration A shmem folio can be either in page cache or in swap cache, but not at the same time. Namely, once it is in swap cache, folio->mapping should be NULL, and the folio is no longer in a shmem mapping. In __folio_migrate_mapping(), to determine the number of xarray entries to update, folio_test_swapbacked() is used, but that conflates shmem in page cache case and shmem in swap cache case. It leads to xarray multi-index entry corruption, since it turns a sibling entry to a normal entry during xas_store() (see [1] for a userspace reproduction). Fix it by only using folio_test_swapcache() to determine whether xarray is storing swap cache entries or not to choose the right number of xarray entries to update. [1] https://lore.kernel.org/linux-mm/Z8idPCkaJW1IChjT@casper.infradead.org/ Note: In __split_huge_page(), folio_test_anon() && folio_test_swapcache() is used to get swap_cache address space, but that ignores the shmem folio in swap cache case. It could lead to NULL pointer dereferencing when a in-swap-cache shmem folio is split at __xa_store(), since !folio_test_anon() is true and folio->mapping is NULL. But fortunately, its caller split_huge_page_to_list_to_order() bails out early with EBUSY when folio->mapping is NULL. So no need to take care of it here.

AI-Powered Analysis

AILast updated: 06/30/2025, 08:13:16 UTC

Technical Analysis

CVE-2025-22015 is a vulnerability in the Linux kernel's memory management subsystem, specifically related to the handling of shared memory (shmem) folios during page migration. The issue arises in the function __folio_migrate_mapping(), which is responsible for updating xarray entries that track page cache and swap cache states. A shmem folio can exist either in the page cache or the swap cache, but not both simultaneously. When a folio is in the swap cache, its mapping pointer should be NULL, indicating it is no longer part of a shmem mapping. However, the vulnerable code incorrectly uses folio_test_swapbacked() to determine how many xarray entries to update, conflating the cases of shmem folios in page cache and swap cache. This leads to corruption of xarray multi-index entries by incorrectly turning sibling entries into normal entries during xas_store() operations. This corruption can cause memory management inconsistencies and potentially lead to system instability or crashes. Additionally, there is a related concern in __split_huge_page() where the code does not properly handle shmem folios in swap cache, which could lead to NULL pointer dereferencing. Fortunately, the caller function split_huge_page_to_list_to_order() prevents this by bailing out early if folio->mapping is NULL, mitigating a potential crash. The vulnerability has been fixed by changing the condition to use folio_test_swapcache() to correctly identify swap cache entries and update the appropriate number of xarray entries. No known exploits are reported in the wild as of the publication date. The affected versions are specific Linux kernel commits identified by their hashes, indicating this is a recent and low-level kernel memory management bug.

Potential Impact

For European organizations, this vulnerability poses a risk primarily to systems running affected Linux kernel versions, especially those using shared memory intensively or relying on swap mechanisms. The corruption of xarray entries can lead to memory management errors, causing kernel panics, system crashes, or unpredictable behavior, which can disrupt critical services and applications. This is particularly impactful for data centers, cloud providers, and enterprises running Linux-based servers or infrastructure. Confidentiality and integrity of data could be indirectly affected if system instability leads to crashes during sensitive operations or if attackers exploit the instability to escalate privileges or cause denial of service. Although no active exploits are known, the complexity of the vulnerability and its kernel-level nature mean that exploitation could be challenging but potentially severe if weaponized. The vulnerability does not require user interaction or authentication, increasing its risk profile in multi-user or exposed environments. Given the widespread use of Linux in European government, finance, telecommunications, and industrial sectors, unpatched systems could face operational disruptions and increased attack surface.

Mitigation Recommendations

European organizations should prioritize updating their Linux kernels to versions that include the fix for CVE-2025-22015. Since the vulnerability is deep in the kernel memory management code, patching is the most effective mitigation. Organizations should: 1) Identify all Linux systems running affected kernel versions by checking kernel commit hashes or versions against vendor advisories. 2) Apply vendor-provided kernel updates or patches immediately, especially on critical infrastructure and production servers. 3) For systems where immediate patching is not feasible, consider isolating them from untrusted networks to reduce exposure. 4) Monitor system logs for unusual kernel errors or crashes that could indicate exploitation attempts or instability related to this vulnerability. 5) Implement robust backup and recovery procedures to mitigate potential data loss from system crashes. 6) Engage with Linux distribution maintainers or vendors for backported patches if using long-term support kernels. 7) Review and test kernel updates in staging environments to ensure stability before wide deployment. These steps go beyond generic advice by emphasizing identification via commit hashes, isolation strategies, and proactive monitoring tailored to this specific kernel memory management flaw.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-12-29T08:45:45.806Z
Cisa Enriched
false
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9831c4522896dcbe7e6e

Added to database: 5/21/2025, 9:09:05 AM

Last enriched: 6/30/2025, 8:13:16 AM

Last updated: 8/9/2025, 7:37:19 PM

Views: 13

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