CVE-2021-46978: KVM: nVMX: Always make an attempt to map eVMCS after migration
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
Remediation
Event History
Frequently Asked Questions
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.
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.
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.
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.
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.