CVE-2021-47277: kvm: avoid speculation-based attacks from out-of-range memslot accesses
In the Linux kernel, the following vulnerability has been resolved:
kvm: avoid speculation-based attacks from out-of-range memslot accesses
KVM's mechanism for accessing guest memory translates a guest physical
address (gpa) to a host virtual address using the right-shifted gpa
(also known as gfn) and a struct kvm_memory_slot. The translation is
performed in __gfn_to_hva_memslot using the following formula:
hva = slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE
It is expected that gfn falls within the boundaries of the guest's
physical memory. However, a guest can access invalid physical addresses
in such a way that the gfn is invalid.
__gfn_to_hva_memslot is called from kvm_vcpu_gfn_to_hva_prot, which first
retrieves a memslot through __gfn_to_memslot. While __gfn_to_memslot
does check that the gfn falls within the boundaries of the guest's
physical memory or not, a CPU can speculate the result of the check and
continue execution speculatively using an illegal gfn. The speculation
can result in calculating an out-of-bounds hva. If the resulting host
virtual address is used to load another guest physical address, this
is effectively a Spectre gadget consisting of two consecutive reads,
the second of which is data dependent on the first.
Right now it's not clear if there are any cases in which this is
exploitable. One interesting case was reported by the original author
of this patch, and involves visiting guest page tables on x86. Right
now these are not vulnerable because the hva read goes through get_user(),
which contains an LFENCE speculation barrier. However, there are
patches in progress for x86 uaccess.h to mask kernel addresses instead of
using LFENCE; once these land, a guest could use speculation to read
from the VMM's ring 3 address space. Other architectures such as ARM
already use the address masking method, and would be susceptible to
this same kind of data-dependent access gadgets. Therefore, this patch
proactively protects from these attacks by masking out-of-bounds gfns
in __gfn_to_hva_memslot, which blocks speculation of invalid hvas.
Sean Christopherson noted that this patch does not cover
kvm_read_guest_offset_cached. This however is limited to a few bytes
past the end of the cache, and therefore it is unlikely to be useful in
the context of building a chain of data dependent accesses.
Security readout for executives and security teams
Plain-English summary
CVE-2021-47277 is a Linux KVM issue where CPU speculation could bypass a guest memory bounds check and compute an invalid host address. The source says exploitability was unclear, but the kernel fix proactively blocks this class of speculative access risk on virtualization hosts.
Executive priority
Treat as a virtualization platform maintenance priority, not an emergency from the provided evidence. Patch KVM hosts during the next appropriate security window, with faster handling for shared or untrusted guest environments.
Technical view
KVM translated guest frame numbers to host virtual addresses after a bounds check. Speculative execution could continue with an out-of-range GFN, creating a possible Spectre-style data-dependent read gadget. The fix masks out-of-bounds GFNs in __gfn_to_hva_memslot to prevent speculative invalid HVA use.
Likely exposure
Exposure is mainly Linux systems running KVM virtualization on affected kernel versions or stable branches. Highest concern is hosts running untrusted or multi-tenant guests. Non-KVM Linux systems are less directly exposed based on the supplied description.
Exploitation context
The source explicitly says it was unclear whether exploitable cases existed. It discusses theoretical paths involving guest page table walks and architecture-specific speculation behavior. KEV is false, and no provided source states active exploitation.
Researcher notes
The public description is unusually candid that exploitability was not established. The interesting risk is a speculative two-read gadget from invalid GFN to invalid HVA, with architecture and uaccess behavior affecting practical exposure. kvm_read_guest_offset_cached was noted as likely less useful.
Mitigation direction
Apply Linux kernel updates containing the referenced stable KVM fixes.
Prioritize KVM hosts running untrusted, customer, or multi-tenant guests.
Check distribution vendor advisories for the exact fixed kernel package.
Reduce exposure of untrusted guests until affected hosts are patched.
Validation and detection
Inventory Linux hosts with KVM enabled and record running kernel versions.
Compare deployed kernels against vendor advisories and referenced stable commits.
Identify whether affected hosts run untrusted or multi-tenant workloads.
Confirm patched hosts include the KVM out-of-bounds GFN masking change.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2021-47277 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.