CVE-2021-46978
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
28/02/2024
Last modified:
14/03/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
KVM: nVMX: Always make an attempt to map eVMCS after migration<br />
<br />
When enlightened VMCS is in use and nested state is migrated with<br />
vmx_get_nested_state()/vmx_set_nested_state() KVM can&#39;t map evmcs<br />
page right away: evmcs gpa is not &#39;struct kvm_vmx_nested_state_hdr&#39;<br />
and we can&#39;t read it from VP assist page because userspace may decide<br />
to restore HV_X64_MSR_VP_ASSIST_PAGE after restoring nested state<br />
(and QEMU, for example, does exactly that). To make sure eVMCS is<br />
mapped /vmx_set_nested_state() raises KVM_REQ_GET_NESTED_STATE_PAGES<br />
request.<br />
<br />
Commit f2c7ef3ba955 ("KVM: nSVM: cancel KVM_REQ_GET_NESTED_STATE_PAGES<br />
on nested vmexit") added KVM_REQ_GET_NESTED_STATE_PAGES clearing to<br />
nested_vmx_vmexit() to make sure MSR permission bitmap is not switched<br />
when an immediate exit from L2 to L1 happens right after migration (caused<br />
by a pending event, for example). Unfortunately, in the exact same<br />
situation we still need to have eVMCS mapped so<br />
nested_sync_vmcs12_to_shadow() reflects changes in VMCS12 to eVMCS.<br />
<br />
As a band-aid, restore nested_get_evmcs_page() when clearing<br />
KVM_REQ_GET_NESTED_STATE_PAGES in nested_vmx_vmexit(). The &#39;fix&#39; is far<br />
from being ideal as we can&#39;t easily propagate possible failures and even if<br />
we could, this is most likely already too late to do so. The whole<br />
&#39;KVM_REQ_GET_NESTED_STATE_PAGES&#39; idea for mapping eVMCS after migration<br />
seems to be fragile as we diverge too much from the &#39;native&#39; path when<br />
vmptr loading happens on vmx_set_nested_state().
Impact
Base Score 3.x
7.80
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.10.13 (including) | 5.10.38 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.11.22 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.12 (including) | 5.12.5 (excluding) |
| cpe:2.3:o:linux:linux_kernel:5.13:rc1:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/200a45649ab7361bc80c70aebf7165b64f9a6c9f
- https://git.kernel.org/stable/c/bd0e8455b85b651a4c77de9616e307129b15aaa7
- https://git.kernel.org/stable/c/c8bf64e3fb77cc19bad146fbe26651985b117194
- https://git.kernel.org/stable/c/f5c7e8425f18fdb9bdb7d13340651d7876890329
- https://git.kernel.org/stable/c/200a45649ab7361bc80c70aebf7165b64f9a6c9f
- https://git.kernel.org/stable/c/bd0e8455b85b651a4c77de9616e307129b15aaa7
- https://git.kernel.org/stable/c/c8bf64e3fb77cc19bad146fbe26651985b117194
- https://git.kernel.org/stable/c/f5c7e8425f18fdb9bdb7d13340651d7876890329



