CVE-2021-46978

Source
https://nvd.nist.gov/vuln/detail/CVE-2021-46978
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2021-46978.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2021-46978
Related
Published
2024-02-28T09:15:37Z
Modified
2024-11-04T18:35:00Z
Summary
[none]
Details

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 KVMREQGETNESTEDSTATE_PAGES 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().

References

Affected packages

Debian:11 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.10.38-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:12 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.10.38-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:13 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.10.38-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}