CVE-2024-35804: KVM: x86: Mark target gfn of emulated atomic instruction as dirty
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
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.1.129-1Fixed in 6.1.135-1Fixed in 6.12.25-1Fixed in 6.12.27-1 - Upgrade
Upgrade
Linux kernel (KVM x86)to a version that resolves this vulnerability.Patch base-commit: 6769ea8da8a93ed4630f1ce64df6aafcaabfce64
Event History
Frequently Asked Questions
What is the severity of CVE-2024-35804?
CVE-2024-35804 is classified as a moderate severity vulnerability in the Linux kernel.
How do I fix CVE-2024-35804?
To mitigate CVE-2024-35804, upgrade to the patched versions of the Linux kernel: 5.10.223-1, 5.10.226-1, 6.1.123-1, 6.1.128-1, 6.12.12-1, or 6.12.13-1.
What impact does CVE-2024-35804 have on affected systems?
CVE-2024-35804 can lead to improper handling of atomic instructions in guest virtual machines, potentially leading to inconsistent states.
What versions of Linux are affected by CVE-2024-35804?
Affected versions of the Linux kernel include any versions prior to the fixed versions listed in the mitigation.
Is CVE-2024-35804 exploited in the wild?
As of the latest information, there have been no confirmed active exploits for CVE-2024-35804.