CVE-2024-58083

Severity CVSS v4.0:
Pending analysis
Type:
CWE-416 Use After Free
Publication date:
06/03/2025
Last modified:
03/11/2025

Description

In the Linux kernel, the following vulnerability has been resolved:<br /> <br /> KVM: Explicitly verify target vCPU is online in kvm_get_vcpu()<br /> <br /> Explicitly verify the target vCPU is fully online _prior_ to clamping the<br /> index in kvm_get_vcpu(). If the index is "bad", the nospec clamping will<br /> generate &amp;#39;0&amp;#39;, i.e. KVM will return vCPU0 instead of NULL.<br /> <br /> In practice, the bug is unlikely to cause problems, as it will only come<br /> into play if userspace or the guest is buggy or misbehaving, e.g. KVM may<br /> send interrupts to vCPU0 instead of dropping them on the floor.<br /> <br /> However, returning vCPU0 when it shouldn&amp;#39;t exist per online_vcpus is<br /> problematic now that KVM uses an xarray for the vCPUs array, as KVM needs<br /> to insert into the xarray before publishing the vCPU to userspace (see<br /> commit c5b077549136 ("KVM: Convert the kvm-&gt;vcpus array to a xarray")),<br /> i.e. before vCPU creation is guaranteed to succeed.<br /> <br /> As a result, incorrectly providing access to vCPU0 will trigger a<br /> use-after-free if vCPU0 is dereferenced and kvm_vm_ioctl_create_vcpu()<br /> bails out of vCPU creation due to an error and frees vCPU0. Commit<br /> afb2acb2e3a3 ("KVM: Fix vcpu_array[0] races") papered over that issue, but<br /> in doing so introduced an unsolvable teardown conundrum. Preventing<br /> accesses to vCPU0 before it&amp;#39;s fully online will allow reverting commit<br /> afb2acb2e3a3, without re-introducing the vcpu_array[0] UAF race.

Vulnerable products and versions

CPE From Up to
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 4.14.120 (including) 4.15 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 4.19.44 (including) 4.20 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.0.17 (including) 5.4.291 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.5 (including) 5.10.235 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.11 (including) 5.15.179 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.16 (including) 6.1.129 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.2 (including) 6.6.78 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.7 (including) 6.12.14 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.13 (including) 6.13.3 (excluding)