CVE-2026-64082: riscv: Fix register corruption from uninitialized cregs on error

Greg Kroah-Hartman <[email protected]>
Newsgroups org.kernel.vger.linux-cve-announce
Message-ID <2026071915-CVE-2026-64082-bf76@gregkh>
From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

riscv: Fix register corruption from uninitialized cregs on error

compat_riscv_gpr_set() calls cregs_to_regs() unconditionally, even when
user_regset_copyin() fails. Since cregs is an uninitialized stack
variable, a copyin failure causes uninitialized stack data to be written
into the target task's pt_regs, corrupting its register state and
potentially leaking kernel stack contents.

compat_restore_sigcontext() has the same issue: it calls cregs_to_regs()
even when __copy_from_user() fails, leading to the same corruption of
the signal-returning task's register state on error.

Only call cregs_to_regs() when the user copy succeeds.

The Linux kernel CVE team has assigned CVE-2026-64082 to this issue.


Affected and fixed versions
===========================

	Issue introduced in 5.19 with commit 7383ee05314be58f8f9f018ee0ac53bef3808aea and fixed in 7.0.11 with commit 9e020156833f1ad0d425a1e3d85b65639f1c1c50
	Issue introduced in 5.19 with commit 7383ee05314be58f8f9f018ee0ac53bef3808aea and fixed in 7.1 with commit 6ebcbb53fc9bc30843054ed99fd60b8e542628f4

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-2026-64082
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/kernel/compat_signal.c
	arch/riscv/kernel/ptrace.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/9e020156833f1ad0d425a1e3d85b65639f1c1c50
	https://git.kernel.org/stable/c/6ebcbb53fc9bc30843054ed99fd60b8e542628f4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.