CVE-2025-39815: RISC-V: KVM: fix stack overrun when loading vlenb
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
RISC-V: KVM: fix stack overrun when loading vlenb
The userspace load can put up to 2048 bits into an xlen bit stack buffer. We want only xlen bits, so check the size beforehand.
The Linux kernel CVE team has assigned CVE-2025-39815 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.8 with commit 2fa290372dfe7dd248b1c16f943f273a3e674f22 and fixed in 6.12.45 with commit c76bf8359188a11f8fd790e5bbd6077894a245cc Issue introduced in 6.8 with commit 2fa290372dfe7dd248b1c16f943f273a3e674f22 and fixed in 6.16.5 with commit 6d28659b692a0212f360f8bd8a58712b339f9aac Issue introduced in 6.8 with commit 2fa290372dfe7dd248b1c16f943f273a3e674f22 and fixed in 6.17-rc4 with commit 799766208f09f95677a9ab111b93872d414fbad7
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2025-39815
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
arch/riscv/kvm/vcpu_vector.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/c76bf8359188a11f8fd790e5bbd6077894a245cc https://git.kernel.org/stable/c/6d28659b692a0212f360f8bd8a58712b339f9aac https://git.kernel.org/stable/c/799766208f09f95677a9ab111b93872d414fbad7