CVE-2024-35791: KVM: SVM: Flush pages under kvm->lock to fix UAF in svm_register_enc_region()

Published May 17, 2024
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

KVM: SVM: Flush pages under kvm->lock to fix UAF in svmregisterencregion()

Do the cache flush of converted pages in svmregisterencregion() before dropping kvm->lock to fix use-after-free issues where region and/or its array of pages could be freed by a different task, e.g. if userspace has unregisterencregionlocked() already queued up for the region.

Note, the "obvious" alternative of using local variables doesn't fully resolve the bug, as region->pages is also dynamically allocated. I.e. the region structure itself would be fine, but region->pages could be freed.

Flushing multiple pages under kvm->lock is unfortunate, but the entire flow is a rare slow path, and the manual flush is only needed on CPUs that lack coherency for encrypted memory.

Other sources

In the Linux kernel, the following vulnerability has been resolved:

KVM: SVM: Flush pages under kvm->lock to fix UAF in svmregisterencregion()

The Linux kernel CVE team has assigned CVE-2024-35791 to this issue.

Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024051708-CVE-2024-35791-65ad@gregkh/T

Red Hat

Affected Software

24 affected componentsFixes available
debian/linux
5.10.223-15.10.234-16.1.129-16.1.135-16.12.25-16.12.27-1
redhat/kernel<5.10.215
5.10.215
redhat/kernel<5.15.154
5.15.154
redhat/kernel<6.1.84
6.1.84
redhat/kernel<6.6.24
6.6.24
redhat/kernel<6.7.12
6.7.12
redhat/kernel<6.8
6.8
Linux Linux kernel>=4.19.176<4.20
Linux Linux kernel>=5.4.98<5.5
Linux Linux kernel>=5.10.15<5.10.215
Linux Linux kernel>=5.11.1<5.15.154
Linux Linux kernel>=5.16<6.1.84
Linux Linux kernel>=6.2<6.6.24
Linux Linux kernel>=6.7<6.7.12
Linux Linux kernel=5.11
Linux Linux kernel=5.11-rc7
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
Debian Debian Linux=10.0

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 redhat/kernel to a version that resolves this vulnerability.

    Fixed in 5.10.215
  3. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 5.15.154
  4. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.1.84
  5. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.6.24
  6. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.7.12
  7. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.8
  8. Compensating control

    Apply the upstream fix described for KVM SVM by ensuring the cache flush of converted pages in svm_register_enc_region() is performed while holding kvm->lock, and only then drop kvm->lock, to prevent UAF where region and/or region->pages could be freed by a different task. (This corresponds to the change titled: “KVM: SVM: Flush pages under kvm->lock to fix UAF in svm_register_enc_region()”.)

  9. Compensating control

    If patching is not immediately possible, mitigate by only relying on systems/CPUs that have coherency for encrypted memory, since the manual flush is only needed on CPUs that lack coherency for encrypted memory (per the description: “the manual flush is only needed on CPUs that lack coherency for encrypted memory”).

Event History

May 17, 2024
CVE Published
via MITRE·12:24 PM
Data Sourced
via MITRE·12:24 PM
DescriptionSeverity
Data Sourced
via NVD·01:15 PM
Description
Data Sourced
via NVD·01:15 PM
RemedySeverityWeaknessAffected Software
Data Sourced
via Red Hat·09:02 PM
DescriptionSeverityAffected Software
Jul 15, 2024
Data Sourced
via Launchpad·05:02 PM
Description
Apr 27, 2025
Data Sourced
via Ubuntu·12:17 AM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-35791?

CVE-2024-35791 is classified as a medium severity vulnerability in the Linux kernel.

2

How do I fix CVE-2024-35791?

To fix CVE-2024-35791, upgrade your Linux kernel to the specified secure versions: 5.10.215, 5.15.154, 6.1.84, 6.6.24, 6.7.12, and 6.8, or the listed Debian kernel updates.

3

Which systems are impacted by CVE-2024-35791?

CVE-2024-35791 impacts various versions of the Linux kernel across multiple distributions including Red Hat and Debian.

4

What type of vulnerability is CVE-2024-35791?

CVE-2024-35791 is a use-after-free (UAF) vulnerability related to the KVM subsystem in the Linux kernel.

5

When was CVE-2024-35791 resolved?

CVE-2024-35791 was resolved with a patch provided in a kernel update shortly after its identification.

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