CVE-2024-35873: riscv: Fix vector state restore in rt_sigreturn()
In the Linux kernel, the following vulnerability has been resolved:
riscv: Fix vector state restore in rt_sigreturn()
The RISC-V Vector specification states in "Appendix D: Calling
Convention for Vector State" [1] that "Executing a system call causes
all caller-saved vector registers (v0-v31, vl, vtype) and vstart to
become unspecified.". In the RISC-V kernel this is called "discarding
the vstate".
Returning from a signal handler via the rt_sigreturn() syscall, vector
discard is also performed. However, this is not an issue since the
vector state should be restored from the sigcontext, and therefore not
care about the vector discard.
The "live state" is the actual vector register in the running context,
and the "vstate" is the vector state of the task. A dirty live state,
means that the vstate and live state are not in synch.
When vectorized user_from_copy() was introduced, an bug sneaked in at
the restoration code, related to the discard of the live state.
An example when this go wrong:
1. A userland application is executing vector code
2. The application receives a signal, and the signal handler is
entered.
3. The application returns from the signal handler, using the
rt_sigreturn() syscall.
4. The live vector state is discarded upon entering the
rt_sigreturn(), and the live state is marked as "dirty", indicating
that the live state need to be synchronized with the current
vstate.
5. rt_sigreturn() restores the vstate, except the Vector registers,
from the sigcontext
6. rt_sigreturn() restores the Vector registers, from the sigcontext,
and now the vectorized user_from_copy() is used. The dirty live
state from the discard is saved to the vstate, making the vstate
corrupt.
7. rt_sigreturn() returns to the application, which crashes due to
corrupted vstate.
Note that the vectorized user_from_copy() is invoked depending on the
value of CONFIG_RISCV_ISA_V_UCOPY_THRESHOLD. Default is 768, which
means that vlen has to be larger than 128b for this bug to trigger.
The fix is simply to mark the live state as non-dirty/clean prior
performing the vstate restore.
Security readout for executives and security teams
Plain-English summary
This Linux kernel issue affects RISC-V systems using vector instructions. After a signal handler returns, the kernel can restore corrupted vector state, causing the affected application to crash. The provided sources do not show privilege escalation, data theft, or active exploitation.
Executive priority
Treat as a targeted platform stability issue. Prioritize patching RISC-V systems supporting production workloads, but it is not currently supported as an emergency internet-wide exploitation risk.
Technical view
The flaw is in RISC-V rt_sigreturn() vector state restoration. A discarded dirty live vector state can be saved over restored task vector state when vectorized user_from_copy() runs, corrupting vstate. The source notes triggering depends on CONFIG_RISCV_ISA_V_UCOPY_THRESHOLD and vector length above 128 bits by default.
Likely exposure
Exposure appears limited to Linux on RISC-V systems using the vector extension, affected kernel versions or commits listed in the CVE, and workloads using vector code with signal handling.
Exploitation context
The provided bundle says KEV is false and gives no evidence of public exploitation. The described outcome is an application crash from corrupted vector state, under specific RISC-V vector conditions.
Researcher notes
The CVE text ties the bug to vectorized user_from_copy() during rt_sigreturn() and dirty live-state handling. Evidence is incomplete for security impact beyond user process crash; avoid assuming broader compromise without additional vendor analysis.
Mitigation direction
Apply Linux kernel updates containing the referenced stable fixes.
Check distribution advisories for backported fixes on RISC-V kernels.
Prioritize RISC-V systems running vector-enabled workloads.
If no vendor package exists, follow vendor kernel guidance before custom patching.
Validation and detection
Inventory RISC-V Linux systems and running kernel versions.
Confirm whether the RISC-V vector extension is enabled or used.
Check kernel builds for CONFIG_RISCV_ISA_V_UCOPY_THRESHOLD behavior.
Verify vendor kernel packages include the referenced stable commits.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2024-35873 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.