Skip to main content

CVE-2024-35804: Vulnerability in Linux Linux

High
VulnerabilityCVE-2024-35804cvecve-2024-35804
Published: Fri May 17 2024 (05/17/2024, 13:23:12 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: KVM: x86: Mark target gfn of emulated atomic instruction as dirty When emulating an atomic access on behalf of the guest, mark the target gfn dirty if the CMPXCHG by KVM is attempted and doesn't fault. This fixes a bug where KVM effectively corrupts guest memory during live migration by writing to guest memory without informing userspace that the page is dirty. Marking the page dirty got unintentionally dropped when KVM's emulated CMPXCHG was converted to do a user access. Before that, KVM explicitly mapped the guest page into kernel memory, and marked the page dirty during the unmap phase. Mark the page dirty even if the CMPXCHG fails, as the old data is written back on failure, i.e. the page is still written. The value written is guaranteed to be the same because the operation is atomic, but KVM's ABI is that all writes are dirty logged regardless of the value written. And more importantly, that's what KVM did before the buggy commit. Huge kudos to the folks on the Cc list (and many others), who did all the actual work of triaging and debugging. base-commit: 6769ea8da8a93ed4630f1ce64df6aafcaabfce64

AI-Powered Analysis

AILast updated: 06/28/2025, 03:11:59 UTC

Technical Analysis

CVE-2024-35804 is a vulnerability in the Linux kernel's KVM (Kernel-based Virtual Machine) subsystem affecting the emulation of atomic instructions on x86 architectures. Specifically, the issue arises during the emulation of the CMPXCHG (compare-and-exchange) atomic instruction. When KVM attempts this operation on behalf of a guest virtual machine, it must mark the guest frame number (gfn) as dirty if the operation modifies guest memory. However, due to a regression introduced when the emulated CMPXCHG was changed to perform user-space memory access, the marking of the target page as dirty was unintentionally omitted. This omission means that KVM could write to guest memory without notifying userspace that the page was modified, leading to potential memory corruption during live migration of virtual machines. The vulnerability affects the integrity of guest memory because the live migration process relies on accurate tracking of dirty pages to synchronize memory state between hosts. If dirty pages are not correctly marked, changes may be lost or inconsistently applied, causing guest memory corruption or data loss. The fix involves ensuring that the target gfn is marked dirty even if the CMPXCHG operation fails, as the old data is still written back atomically. This behavior aligns with KVM's ABI, which requires all writes to be logged as dirty regardless of the value written. The vulnerability impacts multiple Linux kernel versions identified by specific commit hashes and was publicly disclosed on May 17, 2024. There are no known exploits in the wild at this time. The issue is technical and subtle, related to low-level virtualization memory management and atomic instruction emulation, and requires kernel patching to resolve.

Potential Impact

For European organizations, this vulnerability poses a risk primarily to those using KVM-based virtualization on Linux hosts, especially in environments that rely on live migration of virtual machines for load balancing, maintenance, or disaster recovery. The corruption of guest memory during live migration can lead to data integrity issues, application crashes, or system instability within virtualized workloads. This is particularly critical for sectors with high virtualization adoption such as financial services, telecommunications, cloud service providers, and government institutions. The inability to accurately track dirty pages could also undermine the reliability of backup and failover processes that depend on live migration. While no known exploits exist yet, the vulnerability could be leveraged by attackers with privileged access to the host or guest to cause denial of service or data corruption. Given the widespread use of Linux and KVM in European data centers and cloud infrastructure, the impact could be significant if left unpatched, affecting service availability and data trustworthiness.

Mitigation Recommendations

European organizations should prioritize applying the official Linux kernel patches that address CVE-2024-35804 as soon as they become available from their Linux distribution vendors. Specifically, updating to kernel versions that include the fix for proper dirty page marking during CMPXCHG emulation is essential. Organizations should audit their virtualization environments to identify hosts running vulnerable kernel versions and schedule maintenance windows for patch deployment. Additionally, administrators should monitor live migration operations for anomalies or failures that could indicate memory corruption. Implementing strict access controls and monitoring on KVM hosts can reduce the risk of exploitation by limiting who can trigger live migrations or execute privileged operations. For critical workloads, consider temporarily disabling live migration until patches are applied. Finally, testing patched kernels in staging environments before production deployment can help ensure stability and compatibility.

Need more detailed analysis?Get Pro

Technical Details

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

Threat ID: 682d9821c4522896dcbddc3c

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

Last enriched: 6/28/2025, 3:11:59 AM

Last updated: 8/12/2025, 7:12:26 AM

Views: 12

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