Skip to main content

CVE-2024-49878: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2024-49878cvecve-2024-49878
Published: Mon Oct 21 2024 (10/21/2024, 18:01:17 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: resource: fix region_intersects() vs add_memory_driver_managed() On a system with CXL memory, the resource tree (/proc/iomem) related to CXL memory may look like something as follows. 490000000-50fffffff : CXL Window 0 490000000-50fffffff : region0 490000000-50fffffff : dax0.0 490000000-50fffffff : System RAM (kmem) Because drivers/dax/kmem.c calls add_memory_driver_managed() during onlining CXL memory, which makes "System RAM (kmem)" a descendant of "CXL Window X". This confuses region_intersects(), which expects all "System RAM" resources to be at the top level of iomem_resource. This can lead to bugs. For example, when the following command line is executed to write some memory in CXL memory range via /dev/mem, $ dd if=data of=/dev/mem bs=$((1 << 10)) seek=$((0x490000000 >> 10)) count=1 dd: error writing '/dev/mem': Bad address 1+0 records in 0+0 records out 0 bytes copied, 0.0283507 s, 0.0 kB/s the command fails as expected. However, the error code is wrong. It should be "Operation not permitted" instead of "Bad address". More seriously, the /dev/mem permission checking in devmem_is_allowed() passes incorrectly. Although the accessing is prevented later because ioremap() isn't allowed to map system RAM, it is a potential security issue. During command executing, the following warning is reported in the kernel log for calling ioremap() on system RAM. ioremap on RAM at 0x0000000490000000 - 0x0000000490000fff WARNING: CPU: 2 PID: 416 at arch/x86/mm/ioremap.c:216 __ioremap_caller.constprop.0+0x131/0x35d Call Trace: memremap+0xcb/0x184 xlate_dev_mem_ptr+0x25/0x2f write_mem+0x94/0xfb vfs_write+0x128/0x26d ksys_write+0xac/0xfe do_syscall_64+0x9a/0xfd entry_SYSCALL_64_after_hwframe+0x4b/0x53 The details of command execution process are as follows. In the above resource tree, "System RAM" is a descendant of "CXL Window 0" instead of a top level resource. So, region_intersects() will report no System RAM resources in the CXL memory region incorrectly, because it only checks the top level resources. Consequently, devmem_is_allowed() will return 1 (allow access via /dev/mem) for CXL memory region incorrectly. Fortunately, ioremap() doesn't allow to map System RAM and reject the access. So, region_intersects() needs to be fixed to work correctly with the resource tree with "System RAM" not at top level as above. To fix it, if we found a unmatched resource in the top level, we will continue to search matched resources in its descendant resources. So, we will not miss any matched resources in resource tree anymore. In the new implementation, an example resource tree |------------- "CXL Window 0" ------------| |-- "System RAM" --| will behave similar as the following fake resource tree for region_intersects(, IORESOURCE_SYSTEM_RAM, ), |-- "System RAM" --||-- "CXL Window 0a" --| Where "CXL Window 0a" is part of the original "CXL Window 0" that isn't covered by "System RAM".

AI-Powered Analysis

AILast updated: 06/28/2025, 21:10:25 UTC

Technical Analysis

CVE-2024-49878 is a vulnerability in the Linux kernel related to the handling of resource trees for Compute Express Link (CXL) memory regions. The issue arises because the function region_intersects(), which is used to check resource overlaps, assumes that all "System RAM" resources are top-level entries in the iomem_resource tree. However, with CXL memory, the resource tree structure changes such that "System RAM" can become a descendant of a "CXL Window" resource rather than a top-level resource. This structural change causes region_intersects() to incorrectly report that there are no System RAM resources within the CXL memory region. Consequently, the devmem_is_allowed() function, which checks permissions for /dev/mem access, may incorrectly allow access to CXL memory regions because it believes no System RAM is present there. Although the Linux kernel's ioremap() function ultimately prevents mapping of System RAM and blocks unauthorized access, the incorrect permission check represents a potential security flaw. The vulnerability manifests as an incorrect error code and a misleading kernel warning when attempting to write to /dev/mem within the CXL memory range. The root cause is the mismatch in resource tree expectations and the actual hierarchical layout introduced by CXL memory management. The fix involves modifying region_intersects() to recursively search descendant resources if no match is found at the top level, ensuring accurate detection of System RAM resources regardless of their position in the resource tree. This correction prevents devmem_is_allowed() from erroneously granting access and closes the security gap. The vulnerability affects Linux kernel versions identified by the commit hash c221c0b0308fd01d9fb33a16f64d2fd95f8830a4 and is relevant for systems utilizing CXL memory technology.

Potential Impact

For European organizations, the impact of CVE-2024-49878 is primarily related to the security of systems employing Linux kernels with CXL memory support. CXL is an emerging high-speed interconnect technology designed to enhance memory and device sharing capabilities. Organizations using advanced computing infrastructure with CXL memory could face risks where unauthorized access to memory regions might be possible due to incorrect permission checks. Although the kernel's ioremap() function currently prevents direct exploitation, the flawed permission logic could be leveraged in combination with other vulnerabilities or misconfigurations to escalate privileges or bypass security controls. This could lead to unauthorized data access, potential data corruption, or denial of service if memory regions are improperly accessed or manipulated. The vulnerability may also complicate forensic analysis or system monitoring due to misleading error codes and kernel warnings. Given the increasing adoption of CXL in data centers, cloud providers, and high-performance computing environments across Europe, the vulnerability could affect critical infrastructure, research institutions, and enterprises relying on Linux-based systems with CXL memory. However, the absence of known exploits in the wild and the presence of secondary protections reduce immediate risk but do not eliminate the need for prompt remediation.

Mitigation Recommendations

European organizations should take the following specific mitigation steps: 1) Apply the official Linux kernel patches that address CVE-2024-49878 as soon as they become available, ensuring that region_intersects() correctly handles resource trees with nested System RAM entries. 2) Audit systems for the presence of CXL memory and verify kernel versions to identify vulnerable installations. 3) Restrict access to /dev/mem and related interfaces using mandatory access controls (e.g., SELinux, AppArmor) and ensure only trusted administrators have permissions to interact with low-level memory devices. 4) Monitor kernel logs for warnings related to ioremap() on RAM, which may indicate attempts to exploit this or related issues. 5) Implement comprehensive system integrity checks and memory access monitoring to detect anomalous behavior potentially linked to memory access violations. 6) Coordinate with hardware vendors and Linux distribution maintainers to track updates and advisories related to CXL memory support and security. 7) For environments deploying CXL memory, consider additional isolation mechanisms such as virtualization or containerization to limit the impact of potential memory access flaws. These targeted actions go beyond generic advice by focusing on the unique aspects of CXL memory and Linux kernel resource management.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-10-21T12:17:06.021Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9825c4522896dcbe085e

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

Last enriched: 6/28/2025, 9:10:25 PM

Last updated: 7/30/2025, 8:11:54 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