CVE-2024-35804: KVM: x86: Mark target gfn of emulated atomic instruction as dirty

Published May 17, 2024
·
Updated

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

13 affected componentsFixes available
debian/linux
5.10.223-15.10.234-16.1.129-16.1.135-16.12.25-16.12.27-1
Linux Linux kernel>=5.15.58<5.15.154
Linux Linux kernel>=5.17.13<5.18
Linux Linux kernel>=5.18.2<6.1.84
Linux Linux kernel>=6.2<6.6.24
Linux Linux kernel>=6.7<6.7.12
Linux Linux kernel=6.8-rc1
Linux Linux kernel=6.8-rc2
Linux Linux kernel=6.8-rc3
Linux Linux kernel=6.8-rc4
Linux Linux kernel=6.8-rc5
Linux Linux kernel=6.8-rc6
Linux Linux kernel=6.8-rc7

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/linux to 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
  2. Upgrade

    Upgrade Linux kernel (KVM x86) to a version that resolves this vulnerability.

    Patch base-commit: 6769ea8da8a93ed4630f1ce64df6aafcaabfce64

Event History

May 17, 2024
CVE Published
via MITRE·01:23 PM
Data Sourced
via MITRE·01:23 PM
DescriptionSeverity
Data Sourced
via NVD·02:15 PM
Description
Data Sourced
via NVD·02:15 PM
RemedySeverityWeaknessAffected Software
Jul 15, 2024
Data Sourced
via Launchpad·05:02 PM
Description
May 1, 2025
Data Sourced
via Ubuntu·12:19 AM
RemedyDescriptionSeverityAffected Software
May 13, 2025
Data Sourced
via Debian·12:21 AM
DescriptionAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-35804?

CVE-2024-35804 is classified as a moderate severity vulnerability in the Linux kernel.

2

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.

3

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.

4

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.

5

Is CVE-2024-35804 exploited in the wild?

As of the latest information, there have been no confirmed active exploits for CVE-2024-35804.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203