Vulnerability · Published Feb 28, 2024 · Assigned by Linux

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

High 7.8

In plain English

A high-severity security flaw in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.2% (higher than 15% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.8High
Exploit odds (30 days)0.2%top 84.7% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

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 vmx_get_nested_state()/vmx_set_nested_state() KVM can't map evmcs page right away: evmcs gpa is not 'struct kvm_vmx_nested_state_hdr' and we can't read it from VP assist page because userspace may decide to restore HV_X64_MSR_VP_ASSIST_PAGE after restoring nested state (and QEMU, for example, does exactly that). To make sure eVMCS is mapped /vmx_set_nested_state() raises KVM_REQ_GET_NESTED_STATE_PAGES request. Commit f2c7ef3ba955 ("KVM: nSVM: cancel KVM_REQ_GET_NESTED_STATE_PAGES on nested vmexit") added KVM_REQ_GET_NESTED_STATE_PAGES clearing to nested_vmx_vmexit() 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 nested_sync_vmcs12_to_shadow() reflects changes in VMCS12 to eVMCS. As a band-aid, restore nested_get_evmcs_page() when clearing KVM_REQ_GET_NESTED_STATE_PAGES in nested_vmx_vmexit(). 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 'KVM_REQ_GET_NESTED_STATE_PAGES' idea for mapping eVMCS after migration seems to be fragile as we diverge too much from the 'native' path when vmptr loading happens on vmx_set_nested_state().

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12linux5.10.38-1DEBIAN-CVE-2021-46978
Debian:13linux5.10.38-1DEBIAN-CVE-2021-46978
Debian:14linux5.10.38-1DEBIAN-CVE-2021-46978
Ubuntu:22.04:LTSlinux-allwinner-5.19no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-aws-5.19no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-aws-6.2no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-azure-5.19no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-azure-6.2no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-azure-fde-5.19no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-azure-fde-6.2no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-gcp-5.19no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-gcp-6.2no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-hwe-5.19no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-hwe-6.2no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-lowlatency-hwe-5.19no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.2no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-nvidia-6.2no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-oem-5.17no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-oem-6.0no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-oem-6.1no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-riscv-5.19no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-starfive-5.19no fix listedUBUNTU-CVE-2021-46978
Ubuntu:22.04:LTSlinux-starfive-6.2no fix listedUBUNTU-CVE-2021-46978

Affected products (as reported)

VendorProductVersions
Linux Linux 0faceb7d6dda6f370ff1fa0464d7180f7e5cb417 – before c8bf64e3fb77cc19bad146fbe26651985b117194f2c7ef3ba9556d62a7e2bb23b563c6510007d55c – before 200a45649ab7361bc80c70aebf7165b64f9a6c9ff2c7ef3ba9556d62a7e2bb23b563c6510007d55c – before bd0e8455b85b651a4c77de9616e307129b15aaa7f2c7ef3ba9556d62a7e2bb23b563c6510007d55c – before f5c7e8425f18fdb9bdb7d13340651d78768903295.10.13 – before 5.10.38
Linux Linux 5.11

References