HIGH Introduced in 6.6
riscv Ptrace UninitializedMemory
CVE-2026-98951
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
01Description
In the Linux kernel, the following vulnerability has been resolved: riscv: ptrace: Zero-initialize regset buffers before copyin user_regset_copyin() only copies `count` bytes, so a PTRACE_SETREGSET request with a short iov_len leaves the rest of the stack buffer uninitialized. In riscv_vr_set() that garbage is validated and copied into the target's vstate, and in riscv_cfi_set() it can be stored as the target's shadow stack pointer. Zero both buffers, as the get path already does.
02KernelScan AI Analysis
Risk summary
A local attacker with ptrace access to a target process can supply a short register-set payload, causing the kernel to copy uninitialized stack memory into the target's vector register state or shadow stack pointer. This results in arbitrary kernel memory disclosure and controlled corruption of the target task's architectural state, enabling privilege escalation or process compromise.
Vulnerability analysis
The RISC-V ptrace implementation for vector registers (riscv_vr_set) and control-flow integrity state (riscv_cfi_set) allocates stack buffers to receive register-set data from userspace via PTRACE_SETREGSET. The kernel helper user_regset_copyin copies only the number of bytes the caller provides; when the caller supplies a shorter iov_len than the structure size, the remaining bytes in the stack buffer stay uninitialized. Those leftover bytes are then validated and written into the target task's vstate or stored as its shadow stack pointer, leaking kernel stack contents to the target process and allowing the attacker to inject arbitrary values into privileged architectural state. The fix adds explicit memset calls to zero both buffers before the copyin, matching the behavior already present in the corresponding get paths.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 6.5 | 6.5.3 | 6.6 | 89fc70d73f4a |
| 7.2 | 6.6 | 7.2.11 | 59052a88ba5f |
| mainline | 6.6 | 7.3 | — |
04CIP Kernels
State of the newest release of each Civil Infrastructure Platform SLTS tree, from CIP's own fix records.
| CIP tree | State |
|---|---|
| cip/6.12 | Affected — no CIP fix yet (latest 6.12.118-cip136) |