CVE-2024-35873: riscv: Fix vector state restore in rt_sigreturn()

Published May 19, 2024
·
Updated

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

riscv: Fix vector state restore in rtsigreturn()

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 rtsigreturn() 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 userfromcopy() 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 rtsigreturn() syscall. 4. The live vector state is discarded upon entering the rtsigreturn(), and the live state is marked as "dirty", indicating that the live state need to be synchronized with the current vstate. 5. rtsigreturn() restores the vstate, except the Vector registers, from the sigcontext 6. rtsigreturn() restores the Vector registers, from the sigcontext, and now the vectorized userfromcopy() is used. The dirty live state from the discard is saved to the vstate, making the vstate corrupt. 7. rtsigreturn() returns to the application, which crashes due to corrupted vstate.

Note that the vectorized userfromcopy() is invoked depending on the value of CONFIGRISCVISAVUCOPYTHRESHOLD. 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.

Affected Software

4 affected componentsFixes available
debian/linux
5.10.223-15.10.234-16.1.129-16.1.135-16.12.22-16.12.25-1
Linux Linux kernel>=6.8<6.8.5
Linux Linux kernel=6.9-rc1
Linux Linux kernel=6.9-rc2

Event History

May 19, 2024
CVE Published
via MITRE·08:34 AM
Data Sourced
via MITRE·08:34 AM
Description
Data Sourced
via NVD·09:15 AM
Description
Data Sourced
via NVD·09:15 AM
RemedySeverityAffected Software
Jul 11, 2024
Data Sourced
via Launchpad·07:46 PM
Description
Dec 2, 2024
Data Sourced
via Ubuntu·08:17 PM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-35873?

CVE-2024-35873 has been classified as a vulnerability affecting the Linux kernel that requires attention due to potential implications on system stability.

2

How do I fix CVE-2024-35873?

To address CVE-2024-35873, update the Linux kernel to one of the following versions: 5.10.223-1, 5.10.226-1, 6.1.123-1, 6.1.119-1, 6.12.9-1, or 6.12.10-1.

3

Which systems are affected by CVE-2024-35873?

CVE-2024-35873 affects systems running specific versions of the Linux kernel, particularly those on Debian distributions.

4

When was CVE-2024-35873 disclosed?

CVE-2024-35873 was disclosed as part of ongoing security updates in the Linux kernel.

5

Is there a workaround for CVE-2024-35873?

There are no known workarounds for CVE-2024-35873 other than applying the recommended kernel updates.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203