Skip to main content

CVE-2025-21664: Vulnerability in Linux Linux

High
VulnerabilityCVE-2025-21664cvecve-2025-21664
Published: Tue Jan 21 2025 (01/21/2025, 12:18:19 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: dm thin: make get_first_thin use rcu-safe list first function The documentation in rculist.h explains the absence of list_empty_rcu() and cautions programmers against relying on a list_empty() -> list_first() sequence in RCU safe code. This is because each of these functions performs its own READ_ONCE() of the list head. This can lead to a situation where the list_empty() sees a valid list entry, but the subsequent list_first() sees a different view of list head state after a modification. In the case of dm-thin, this author had a production box crash from a GP fault in the process_deferred_bios path. This function saw a valid list head in get_first_thin() but when it subsequently dereferenced that and turned it into a thin_c, it got the inside of the struct pool, since the list was now empty and referring to itself. The kernel on which this occurred printed both a warning about a refcount_t being saturated, and a UBSAN error for an out-of-bounds cpuid access in the queued spinlock, prior to the fault itself. When the resulting kdump was examined, it was possible to see another thread patiently waiting in thin_dtr's synchronize_rcu. The thin_dtr call managed to pull the thin_c out of the active thins list (and have it be the last entry in the active_thins list) at just the wrong moment which lead to this crash. Fortunately, the fix here is straight forward. Switch get_first_thin() function to use list_first_or_null_rcu() which performs just a single READ_ONCE() and returns NULL if the list is already empty. This was run against the devicemapper test suite's thin-provisioning suites for delete and suspend and no regressions were observed.

AI-Powered Analysis

AILast updated: 06/30/2025, 16:54:58 UTC

Technical Analysis

CVE-2025-21664 is a vulnerability identified in the Linux kernel's device mapper thin provisioning (dm-thin) subsystem. The issue arises from improper handling of Read-Copy-Update (RCU) safe list operations in the get_first_thin() function. Specifically, the function originally used a sequence of list_empty() followed by list_first(), each performing independent READ_ONCE() operations on the list head. This can cause a race condition where list_empty() sees a non-empty list, but list_first() subsequently observes a different state due to concurrent modifications, leading to dereferencing invalid pointers. In practice, this flaw caused a production system crash due to a general protection fault in the process_deferred_bios path. The crash was triggered when get_first_thin() returned a pointer that was actually the list head itself (an empty list referencing itself), resulting in invalid memory access. Additional kernel warnings were observed, including refcount saturation and undefined behavior sanitizer (UBSAN) errors related to out-of-bounds CPU ID access in queued spinlocks. The root cause was a timing window where another thread removed the last entry from the active_thins list during synchronization, causing the race. The fix replaces the vulnerable code with list_first_or_null_rcu(), which performs a single READ_ONCE() operation and returns NULL if the list is empty, eliminating the race condition. Testing against the devicemapper thin provisioning test suite showed no regressions. This vulnerability affects Linux kernel versions identified by the commit hash b10ebd34cccae1b431caf1be54919aede2be7cbe and likely related versions. No known exploits are currently reported in the wild.

Potential Impact

For European organizations, the impact of CVE-2025-21664 could be significant in environments relying on Linux servers using device mapper thin provisioning, especially in data centers, cloud infrastructure, and enterprise storage solutions. The vulnerability can cause kernel crashes leading to denial of service (DoS) conditions, potentially disrupting critical services and applications. Systems handling large-scale storage virtualization or thin provisioning are at higher risk. While the vulnerability does not directly enable privilege escalation or remote code execution, the resulting instability and crashes can impact availability and reliability of services. Organizations with high availability requirements, such as financial institutions, healthcare providers, and public sector entities, could face operational disruptions. Additionally, kernel crashes may lead to data corruption or loss if not properly managed. Since Linux is widely deployed across European IT infrastructure, especially in server and cloud environments, the scope of affected systems is broad. The absence of known exploits reduces immediate risk, but the complexity of the flaw and its subtle race condition nature mean that targeted attackers or accidental triggers could cause outages.

Mitigation Recommendations

European organizations should prioritize updating Linux kernels to versions that include the patch fixing CVE-2025-21664. Specifically, ensure that the get_first_thin() function uses list_first_or_null_rcu() to prevent the race condition. System administrators should monitor kernel updates from trusted Linux distributions and apply them promptly. In environments where immediate patching is not feasible, consider implementing kernel crash monitoring and automated recovery mechanisms to minimize downtime. Additionally, review and test device mapper thin provisioning configurations to detect unusual behavior or instability. Employing kernel hardening techniques and enabling kernel debugging features can help identify early signs of exploitation or crashes. Organizations should also maintain robust backup and disaster recovery plans to mitigate potential data loss from unexpected kernel faults. Finally, coordinate with Linux distribution vendors and security teams to stay informed about further developments or related vulnerabilities.

Need more detailed analysis?Get Pro

Technical Details

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

Threat ID: 682d9834c4522896dcbe9778

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

Last enriched: 6/30/2025, 4:54:58 PM

Last updated: 8/16/2025, 4:40:32 AM

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