CVE-2024-40953
Severity CVSS v4.0:
Pending analysis
Type:
CWE-362
Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Publication date:
12/07/2024
Last modified:
03/11/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
KVM: Fix a data race on last_boosted_vcpu in kvm_vcpu_on_spin()<br />
<br />
Use {READ,WRITE}_ONCE() to access kvm->last_boosted_vcpu to ensure the<br />
loads and stores are atomic. In the extremely unlikely scenario the<br />
compiler tears the stores, it&#39;s theoretically possible for KVM to attempt<br />
to get a vCPU using an out-of-bounds index, e.g. if the write is split<br />
into multiple 8-bit stores, and is paired with a 32-bit load on a VM with<br />
257 vCPUs:<br />
<br />
CPU0 CPU1<br />
last_boosted_vcpu = 0xff;<br />
<br />
(last_boosted_vcpu = 0x100)<br />
last_boosted_vcpu[15:8] = 0x01;<br />
i = (last_boosted_vcpu = 0x1ff)<br />
last_boosted_vcpu[7:0] = 0x00;<br />
<br />
vcpu = kvm->vcpu_array[0x1ff];<br />
<br />
As detected by KCSAN:<br />
<br />
BUG: KCSAN: data-race in kvm_vcpu_on_spin [kvm] / kvm_vcpu_on_spin [kvm]<br />
<br />
write to 0xffffc90025a92344 of 4 bytes by task 4340 on cpu 16:<br />
kvm_vcpu_on_spin (arch/x86/kvm/../../../virt/kvm/kvm_main.c:4112) kvm<br />
handle_pause (arch/x86/kvm/vmx/vmx.c:5929) kvm_intel<br />
vmx_handle_exit (arch/x86/kvm/vmx/vmx.c:?<br />
arch/x86/kvm/vmx/vmx.c:6606) kvm_intel<br />
vcpu_run (arch/x86/kvm/x86.c:11107 arch/x86/kvm/x86.c:11211) kvm<br />
kvm_arch_vcpu_ioctl_run (arch/x86/kvm/x86.c:?) kvm<br />
kvm_vcpu_ioctl (arch/x86/kvm/../../../virt/kvm/kvm_main.c:?) kvm<br />
__se_sys_ioctl (fs/ioctl.c:52 fs/ioctl.c:904 fs/ioctl.c:890)<br />
__x64_sys_ioctl (fs/ioctl.c:890)<br />
x64_sys_call (arch/x86/entry/syscall_64.c:33)<br />
do_syscall_64 (arch/x86/entry/common.c:?)<br />
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)<br />
<br />
read to 0xffffc90025a92344 of 4 bytes by task 4342 on cpu 4:<br />
kvm_vcpu_on_spin (arch/x86/kvm/../../../virt/kvm/kvm_main.c:4069) kvm<br />
handle_pause (arch/x86/kvm/vmx/vmx.c:5929) kvm_intel<br />
vmx_handle_exit (arch/x86/kvm/vmx/vmx.c:?<br />
arch/x86/kvm/vmx/vmx.c:6606) kvm_intel<br />
vcpu_run (arch/x86/kvm/x86.c:11107 arch/x86/kvm/x86.c:11211) kvm<br />
kvm_arch_vcpu_ioctl_run (arch/x86/kvm/x86.c:?) kvm<br />
kvm_vcpu_ioctl (arch/x86/kvm/../../../virt/kvm/kvm_main.c:?) kvm<br />
__se_sys_ioctl (fs/ioctl.c:52 fs/ioctl.c:904 fs/ioctl.c:890)<br />
__x64_sys_ioctl (fs/ioctl.c:890)<br />
x64_sys_call (arch/x86/entry/syscall_64.c:33)<br />
do_syscall_64 (arch/x86/entry/common.c:?)<br />
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)<br />
<br />
value changed: 0x00000012 -> 0x00000000
Impact
Base Score 3.x
4.70
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 2.6.39 (including) | 4.19.323 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.20 (including) | 5.4.285 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.228 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.169 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.96 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.36 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.9.7 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.10:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.10:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.10:rc3:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.10:rc4:*:*:*:*:*:* |
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/11a772d5376aa6d3e2e69b5b5c585f79b60c0e17
- https://git.kernel.org/stable/c/49f683b41f28918df3e51ddc0d928cb2e934ccdb
- https://git.kernel.org/stable/c/4c141136a28421b78f34969b25a4fa32e06e2180
- https://git.kernel.org/stable/c/71fbc3af3dacb26c3aa2f30bb3ab05c44d082c84
- https://git.kernel.org/stable/c/82bd728a06e55f5b5f93d10ce67f4fe7e689853a
- https://git.kernel.org/stable/c/92c77807d938145c7c3350c944ef9f39d7f6017c
- https://git.kernel.org/stable/c/95c8dd79f3a14df96b3820b35b8399bd91b2be60
- https://git.kernel.org/stable/c/a937ef951bba72f48d2402451419d725d70dba20
- https://git.kernel.org/stable/c/49f683b41f28918df3e51ddc0d928cb2e934ccdb
- https://git.kernel.org/stable/c/92c77807d938145c7c3350c944ef9f39d7f6017c
- https://git.kernel.org/stable/c/95c8dd79f3a14df96b3820b35b8399bd91b2be60
- https://git.kernel.org/stable/c/a937ef951bba72f48d2402451419d725d70dba20
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html
- https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html



