CVE-2021-46978: KVM: nVMX: Always make an attempt to map eVMCS after migration

Published Feb 28, 2024
·
Updated

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

KVM: nVMX: Always make an attempt to map eVMCS after migration

When enlightened VMCS is in use and nested state is migrated with vmxgetnestedstate()/vmxsetnestedstate() KVM can't map evmcs page right away: evmcs gpa is not 'struct kvmvmxnestedstatehdr' and we can't read it from VP assist page because userspace may decide to restore HVX64MSRVPASSISTPAGE after restoring nested state (and QEMU, for example, does exactly that). To make sure eVMCS is mapped /vmxsetnestedstate() raises KVMREQGETNESTEDSTATEPAGES request.

Commit f2c7ef3ba955 ("KVM: nSVM: cancel KVMREQGETNESTEDSTATEPAGES on nested vmexit") added KVMREQGETNESTEDSTATEPAGES clearing to nestedvmxvmexit() to make sure MSR permission bitmap is not switched when an immediate exit from L2 to L1 happens right after migration (caused by a pending event, for example). Unfortunately, in the exact same situation we still need to have eVMCS mapped so nestedsyncvmcs12toshadow() reflects changes in VMCS12 to eVMCS.

As a band-aid, restore nestedgetevmcspage() when clearing KVMREQGETNESTEDSTATEPAGES in nestedvmxvmexit(). The 'fix' is far from being ideal as we can't easily propagate possible failures and even if we could, this is most likely already too late to do so. The whole 'KVMREQGETNESTEDSTATEPAGES' idea for mapping eVMCS after migration seems to be fragile as we diverge too much from the 'native' path when vmptr loading happens on vmxsetnestedstate().

Affected Software

5 affected components
Linux Kernel
Linux Linux kernel>=5.10.13<5.10.38
Linux Linux kernel>=5.11<5.11.22
Linux Linux kernel>=5.12<5.12.5
Linux Linux kernel=5.13-rc1

Event History

Feb 28, 2024
CVE Published
via MITRE·08:13 AM
Data Sourced
via MITRE·08:13 AM
Description
Data Sourced
via NVD·09:15 AM
DescriptionSeverity

Frequently Asked Questions

1

What is the severity of CVE-2021-46978?

CVE-2021-46978 has a medium severity rating due to potential denial-of-service conditions during virtual machine migrations in the Linux kernel.

2

How do I fix CVE-2021-46978?

To mitigate CVE-2021-46978, you should update your Linux kernel to a version that includes the security patch addressing this vulnerability.

3

Which versions of the Linux kernel are affected by CVE-2021-46978?

CVE-2021-46978 affects multiple versions of the Linux kernel including versions from 5.10.13 to 5.10.38, 5.11.0 to 5.11.22, and 5.12.0 to 5.12.5.

4

Is CVE-2021-46978 exploitable remotely?

CVE-2021-46978 is not considered remotely exploitable as it requires local access to the affected virtual machine environment.

5

What types of systems are affected by CVE-2021-46978?

CVE-2021-46978 primarily affects virtualization systems utilizing KVM and nested virtualization in the Linux kernel.

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