CVE-2024-57945: Vulnerability in Linux Linux
In the Linux kernel, the following vulnerability has been resolved: riscv: mm: Fix the out of bound issue of vmemmap address In sparse vmemmap model, the virtual address of vmemmap is calculated as: ((struct page *)VMEMMAP_START - (phys_ram_base >> PAGE_SHIFT)). And the struct page's va can be calculated with an offset: (vmemmap + (pfn)). However, when initializing struct pages, kernel actually starts from the first page from the same section that phys_ram_base belongs to. If the first page's physical address is not (phys_ram_base >> PAGE_SHIFT), then we get an va below VMEMMAP_START when calculating va for it's struct page. For example, if phys_ram_base starts from 0x82000000 with pfn 0x82000, the first page in the same section is actually pfn 0x80000. During init_unavailable_range(), we will initialize struct page for pfn 0x80000 with virtual address ((struct page *)VMEMMAP_START - 0x2000), which is below VMEMMAP_START as well as PCI_IO_END. This commit fixes this bug by introducing a new variable 'vmemmap_start_pfn' which is aligned with memory section size and using it to calculate vmemmap address instead of phys_ram_base.
AI Analysis
Technical Summary
CVE-2024-57945 is a vulnerability identified in the Linux kernel specifically affecting the RISC-V architecture's memory management subsystem. The issue arises in the sparse vmemmap model, which is responsible for mapping physical memory pages to their corresponding virtual addresses in the kernel's address space. The vulnerability is due to an incorrect calculation of the virtual address for struct page objects. The kernel calculates the virtual address of vmemmap as ((struct page *)VMEMMAP_START - (phys_ram_base >> PAGE_SHIFT)), and the virtual address of a struct page as (vmemmap + pfn). However, during initialization, the kernel starts struct page initialization from the first page of the memory section that phys_ram_base belongs to, which may not correspond to (phys_ram_base >> PAGE_SHIFT). This discrepancy can cause the virtual address of some struct pages to be calculated below VMEMMAP_START, potentially overlapping with reserved address ranges such as PCI_IO_END. This out-of-bounds virtual address calculation can lead to memory corruption or undefined behavior within the kernel's memory management. The fix introduces a new variable, 'vmemmap_start_pfn', aligned with the memory section size, to correctly calculate the vmemmap address, ensuring virtual addresses remain within valid bounds. This vulnerability affects multiple versions of the Linux kernel source code as indicated by the commit hashes listed and is specific to the RISC-V architecture's memory management implementation. No known exploits are currently reported in the wild, and no CVSS score has been assigned yet.
Potential Impact
For European organizations, the impact of CVE-2024-57945 depends largely on the deployment of Linux systems running on RISC-V architecture, which is currently less common compared to x86 or ARM architectures. However, as RISC-V gains traction in embedded systems, IoT devices, and specialized computing environments, this vulnerability could pose risks to critical infrastructure or industrial control systems that rely on Linux-based RISC-V devices. The out-of-bounds virtual memory mapping could lead to kernel memory corruption, potentially allowing local attackers or compromised processes to escalate privileges, cause system crashes, or disrupt availability. In environments where RISC-V Linux systems are used for sensitive operations, this could lead to confidentiality breaches or integrity violations. Given the kernel-level nature of the flaw, exploitation could undermine the security guarantees of the entire system. Although no exploits are known currently, the vulnerability's presence in memory management suggests a high potential for impactful exploitation if weaponized. European organizations in sectors such as manufacturing, telecommunications, or research institutions experimenting with RISC-V platforms should be particularly vigilant.
Mitigation Recommendations
To mitigate CVE-2024-57945, organizations should prioritize updating their Linux kernel to the patched versions that incorporate the fix introducing 'vmemmap_start_pfn' for correct virtual address calculation. Since this vulnerability is architecture-specific, verifying the kernel configuration and architecture is critical before applying patches. For environments deploying RISC-V Linux systems, ensure that kernel updates are tested and rolled out promptly. Additionally, implement strict access controls to limit local user privileges, reducing the risk of exploitation by unprivileged users. Employ kernel hardening techniques such as Kernel Address Space Layout Randomization (KASLR) and secure boot mechanisms to further protect against kernel-level attacks. Monitoring system logs for unusual kernel memory errors or crashes can provide early detection of attempted exploitation. For embedded or IoT devices running RISC-V Linux, coordinate with device vendors to obtain firmware updates incorporating the kernel patch. Finally, maintain a robust patch management process that includes architecture-specific vulnerabilities to ensure timely remediation.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland
CVE-2024-57945: Vulnerability in Linux Linux
Description
In the Linux kernel, the following vulnerability has been resolved: riscv: mm: Fix the out of bound issue of vmemmap address In sparse vmemmap model, the virtual address of vmemmap is calculated as: ((struct page *)VMEMMAP_START - (phys_ram_base >> PAGE_SHIFT)). And the struct page's va can be calculated with an offset: (vmemmap + (pfn)). However, when initializing struct pages, kernel actually starts from the first page from the same section that phys_ram_base belongs to. If the first page's physical address is not (phys_ram_base >> PAGE_SHIFT), then we get an va below VMEMMAP_START when calculating va for it's struct page. For example, if phys_ram_base starts from 0x82000000 with pfn 0x82000, the first page in the same section is actually pfn 0x80000. During init_unavailable_range(), we will initialize struct page for pfn 0x80000 with virtual address ((struct page *)VMEMMAP_START - 0x2000), which is below VMEMMAP_START as well as PCI_IO_END. This commit fixes this bug by introducing a new variable 'vmemmap_start_pfn' which is aligned with memory section size and using it to calculate vmemmap address instead of phys_ram_base.
AI-Powered Analysis
Technical Analysis
CVE-2024-57945 is a vulnerability identified in the Linux kernel specifically affecting the RISC-V architecture's memory management subsystem. The issue arises in the sparse vmemmap model, which is responsible for mapping physical memory pages to their corresponding virtual addresses in the kernel's address space. The vulnerability is due to an incorrect calculation of the virtual address for struct page objects. The kernel calculates the virtual address of vmemmap as ((struct page *)VMEMMAP_START - (phys_ram_base >> PAGE_SHIFT)), and the virtual address of a struct page as (vmemmap + pfn). However, during initialization, the kernel starts struct page initialization from the first page of the memory section that phys_ram_base belongs to, which may not correspond to (phys_ram_base >> PAGE_SHIFT). This discrepancy can cause the virtual address of some struct pages to be calculated below VMEMMAP_START, potentially overlapping with reserved address ranges such as PCI_IO_END. This out-of-bounds virtual address calculation can lead to memory corruption or undefined behavior within the kernel's memory management. The fix introduces a new variable, 'vmemmap_start_pfn', aligned with the memory section size, to correctly calculate the vmemmap address, ensuring virtual addresses remain within valid bounds. This vulnerability affects multiple versions of the Linux kernel source code as indicated by the commit hashes listed and is specific to the RISC-V architecture's memory management implementation. No known exploits are currently reported in the wild, and no CVSS score has been assigned yet.
Potential Impact
For European organizations, the impact of CVE-2024-57945 depends largely on the deployment of Linux systems running on RISC-V architecture, which is currently less common compared to x86 or ARM architectures. However, as RISC-V gains traction in embedded systems, IoT devices, and specialized computing environments, this vulnerability could pose risks to critical infrastructure or industrial control systems that rely on Linux-based RISC-V devices. The out-of-bounds virtual memory mapping could lead to kernel memory corruption, potentially allowing local attackers or compromised processes to escalate privileges, cause system crashes, or disrupt availability. In environments where RISC-V Linux systems are used for sensitive operations, this could lead to confidentiality breaches or integrity violations. Given the kernel-level nature of the flaw, exploitation could undermine the security guarantees of the entire system. Although no exploits are known currently, the vulnerability's presence in memory management suggests a high potential for impactful exploitation if weaponized. European organizations in sectors such as manufacturing, telecommunications, or research institutions experimenting with RISC-V platforms should be particularly vigilant.
Mitigation Recommendations
To mitigate CVE-2024-57945, organizations should prioritize updating their Linux kernel to the patched versions that incorporate the fix introducing 'vmemmap_start_pfn' for correct virtual address calculation. Since this vulnerability is architecture-specific, verifying the kernel configuration and architecture is critical before applying patches. For environments deploying RISC-V Linux systems, ensure that kernel updates are tested and rolled out promptly. Additionally, implement strict access controls to limit local user privileges, reducing the risk of exploitation by unprivileged users. Employ kernel hardening techniques such as Kernel Address Space Layout Randomization (KASLR) and secure boot mechanisms to further protect against kernel-level attacks. Monitoring system logs for unusual kernel memory errors or crashes can provide early detection of attempted exploitation. For embedded or IoT devices running RISC-V Linux, coordinate with device vendors to obtain firmware updates incorporating the kernel patch. Finally, maintain a robust patch management process that includes architecture-specific vulnerabilities to ensure timely remediation.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- Linux
- Date Reserved
- 2025-01-19T11:50:08.380Z
- Cisa Enriched
- false
- Cvss Version
- null
- State
- PUBLISHED
Threat ID: 682d9820c4522896dcbdd203
Added to database: 5/21/2025, 9:08:48 AM
Last enriched: 7/4/2025, 2:56:10 AM
Last updated: 8/2/2025, 7:17:42 PM
Views: 12
Related Threats
CVE-2025-9060: CWE-20 Improper Input Validation in MSoft MFlash
CriticalCVE-2025-8675: CWE-918 Server-Side Request Forgery (SSRF) in Drupal AI SEO Link Advisor
MediumCVE-2025-8362: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in Drupal GoogleTag Manager
MediumCVE-2025-8361: CWE-962 Missing Authorization in Drupal Config Pages
HighCVE-2025-8092: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in Drupal COOKiES Consent Management
HighActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.