CVE-2021-47277

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.
ProviderTypeBase ScoreAtk. VectorAtk. ComplexityPriv. RequiredVector
NISTNIST
7.1 HIGH
LOCAL
LOW
LOW
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H
LinuxCNA
---
---
CISA-ADPADP
---
---
CVEADP
---
---
Base Score
CVSS 3.x
EPSS Score
Percentile: 8%
VendorProductVersion
linuxlinux_kernel
𝑥
< 4.4.273
linuxlinux_kernel
4.5 ≤
𝑥
< 4.9.273
linuxlinux_kernel
4.10 ≤
𝑥
< 4.14.237
linuxlinux_kernel
4.15 ≤
𝑥
< 4.19.195
linuxlinux_kernel
4.20 ≤
𝑥
< 5.4.126
linuxlinux_kernel
5.5 ≤
𝑥
< 5.10.44
linuxlinux_kernel
5.11 ≤
𝑥
< 5.12.11
linuxlinux_kernel
5.13:rc1
linuxlinux_kernel
5.13:rc2
linuxlinux_kernel
5.13:rc3
linuxlinux_kernel
5.13:rc4
linuxlinux_kernel
5.13:rc5
𝑥
= Vulnerable software versions
Debian logo
Debian Releases
Debian Product
Codename
linux
bullseye
5.10.223-1
fixed
bullseye (security)
5.10.226-1
fixed
bookworm
6.1.106-3
fixed
bookworm (security)
6.1.112-1
fixed
trixie
6.11.5-1
fixed
sid
6.11.6-1
fixed
Ubuntu logo
Ubuntu Releases
Ubuntu Product
Codename
linux
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
Fixed 5.4.0-81.91
released
bionic
not-affected
xenial
ignored
trusty
ignored
linux-allwinner-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-aws
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
Fixed 5.4.0-1055.58
released
bionic
not-affected
xenial
ignored
trusty
ignored
linux-aws-5.0
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-aws-5.11
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-aws-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-aws-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-aws-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-aws-5.3
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-aws-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-aws-5.8
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-aws-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-aws-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-aws-fips
noble
dne
mantic
dne
jammy
dne
focal
dne
linux-aws-hwe
noble
dne
mantic
dne
jammy
dne
focal
dne
xenial
Fixed 4.15.0-1111.118~16.04.1
released
linux-azure
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
Fixed 5.4.0-1056.58
released
bionic
ignored
xenial
Fixed 4.15.0-1123.136~16.04.1
released
trusty
Fixed 4.15.0-1123.136~14.04.1
released
linux-azure-4.15
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-azure-5.11
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-azure-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-azure-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-azure-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-azure-5.3
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-azure-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-azure-5.8
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-azure-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-azure-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-azure-edge
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-azure-fde
noble
dne
mantic
dne
jammy
not-affected
focal
ignored
linux-azure-fde-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-azure-fde-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-azure-fde-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-azure-fips
noble
dne
mantic
dne
jammy
dne
focal
dne
linux-bluefield
noble
dne
mantic
dne
jammy
dne
focal
Fixed 5.4.0-1019.22
released
linux-fips
noble
dne
mantic
dne
jammy
dne
focal
dne
linux-gcp
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
Fixed 5.4.0-1051.55
released
bionic
ignored
xenial
Fixed 4.15.0-1108.122~16.04.1
released
linux-gcp-4.15
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-gcp-5.11
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-gcp-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-gcp-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-gcp-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-gcp-5.3
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-gcp-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-gcp-5.8
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-gcp-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-gcp-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-gcp-fips
noble
dne
mantic
dne
jammy
dne
focal
dne
linux-gke
noble
not-affected
mantic
dne
jammy
not-affected
focal
ignored
linux-gke-4.15
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-gke-5.15
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-gke-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-gkeop
noble
dne
mantic
dne
jammy
not-affected
focal
Fixed 5.4.0-1022.23
released
linux-gkeop-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-gkeop-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-hwe
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
xenial
Fixed 4.15.0-156.163~16.04.1
released
linux-hwe-5.11
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-hwe-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-hwe-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-hwe-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-hwe-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-hwe-5.8
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-hwe-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-hwe-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-hwe-6.8
noble
dne
jammy
not-affected
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-hwe-edge
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
xenial
ignored
linux-ibm
noble
not-affected
mantic
ignored
jammy
not-affected
focal
not-affected
linux-ibm-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-ibm-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-intel
noble
not-affected
mantic
dne
jammy
dne
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-intel-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-intel-iot-realtime
noble
dne
jammy
dne
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-intel-iotg
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-intel-iotg-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-iot
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-kvm
noble
dne
mantic
dne
jammy
not-affected
focal
Fixed 5.4.0-1045.47
released
bionic
not-affected
xenial
ignored
linux-laptop
noble
dne
mantic
not-affected
jammy
dne
focal
dne
linux-lowlatency
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
dne
linux-lowlatency-hwe-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-lowlatency-hwe-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-lowlatency-hwe-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-lowlatency-hwe-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-lowlatency-hwe-6.8
noble
dne
jammy
not-affected
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-lts-xenial
noble
dne
mantic
dne
jammy
dne
focal
dne
trusty
ignored
linux-nvidia
noble
not-affected
mantic
dne
jammy
not-affected
focal
dne
linux-nvidia-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-nvidia-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-nvidia-6.8
noble
dne
jammy
not-affected
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-nvidia-lowlatency
noble
not-affected
jammy
dne
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-oem
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-oem-5.10
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oem-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oem-5.14
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oem-5.17
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-oem-5.6
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oem-6.0
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-oem-6.1
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-oem-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-oem-6.8
noble
not-affected
mantic
dne
jammy
dne
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-oracle
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
Fixed 5.4.0-1053.57
released
bionic
not-affected
xenial
Fixed 4.15.0-1080.88~16.04.1
released
linux-oracle-5.0
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-oracle-5.11
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oracle-5.13
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oracle-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-oracle-5.3
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
ignored
linux-oracle-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-oracle-5.8
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-oracle-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-raspi
noble
not-affected
mantic
not-affected
jammy
not-affected
focal
Fixed 5.4.0-1042.46
released
linux-raspi-5.4
noble
dne
mantic
dne
jammy
dne
focal
dne
bionic
not-affected
linux-raspi-realtime
noble
dne
jammy
dne
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-raspi2
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-realtime
noble
dne
jammy
ignored
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-riscv
noble
not-affected
mantic
not-affected
jammy
ignored
focal
ignored
linux-riscv-5.11
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-riscv-5.15
noble
dne
mantic
dne
jammy
dne
focal
not-affected
linux-riscv-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-riscv-5.8
noble
dne
mantic
dne
jammy
dne
focal
ignored
linux-riscv-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-riscv-6.8
noble
dne
jammy
not-affected
focal
dne
bionic
dne
xenial
dne
trusty
dne
linux-starfive
noble
dne
mantic
not-affected
jammy
dne
focal
dne
linux-starfive-5.19
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-starfive-6.2
noble
dne
mantic
dne
jammy
ignored
focal
dne
linux-starfive-6.5
noble
dne
mantic
dne
jammy
not-affected
focal
dne
linux-xilinx-zynqmp
noble
dne
mantic
dne
jammy
not-affected
focal
not-affected