CVE-2024-35871: riscv: process: Fix kernel gp leakage

Published May 19, 2024
·
Updated

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

riscv: process: Fix kernel gp leakage

childregs represents the registers which are active for the new thread in user context. For a kernel thread, childregs->gp is never used since the kernel gp is not touched by switchto. For a user mode helper, the gp value can be observed in user space after execve or possibly by other means.

[From the email thread]

The / Kernel thread / comment is somewhat inaccurate in that it is also used for usermodehelper threads, which exec a user process, e.g. /sbin/init or when /proc/sys/kernel/corepattern is a pipe. Such threads do not have PFKTHREAD set and are valid targets for ptrace etc. even before they exec.

childregs is the user context during syscall execution and it is observable from userspace in at least five ways:

1. kernelexecve does not currently clear integer registers, so the starting register state for PID 1 and other user processes started by the kernel has sp = user stack, gp = kernel globalpointer$, all other integer registers zeroed by the memset in the patch comment.

This is a bug in its own right, but I'm unwilling to bet that it is the only way to exploit the issue addressed by this patch.

2. ptrace(PTRACEGETREGSET): you can PTRACEATTACH to a usermodehelper thread before it execs, but ptrace requires SIGSTOP to be delivered which can only happen at user/kernel boundaries.

3. /proc//task//syscall: this is perfectly happy to read ptregs for usermodehelpers before the exec completes, but gp is not one of the registers it returns.

4. PERFSAMPLEREGSUSER: LOCKDOWNPERF normally prevents access to kernel addresses via PERFSAMPLEREGSINTR, but due to this bug kernel addresses are also exposed via PERFSAMPLEREGSUSER which is permitted under LOCKDOWNPERF. I have not attempted to write exploit code.

5. Much of the tracing infrastructure allows access to user registers. I have not attempted to determine which forms of tracing allow access to user registers without already allowing access to kernel registers.

Affected Software

9 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>=4.15<5.10.216
Linux Linux kernel>=5.11<5.15.154
Linux Linux kernel>=5.16<6.1.85
Linux Linux kernel>=6.2<6.6.26
Linux Linux kernel>=6.7<6.8.5
Linux Linux kernel=6.9-rc1
Linux Linux kernel=6.9-rc2
Debian Debian Linux=10.0

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 15, 2024
Data Sourced
via Launchpad·07:46 PM
Description
May 1, 2025
Data Sourced
via Ubuntu·12:22 AM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-35871?

CVE-2024-35871 has a medium severity level due to the potential for information leakage in the Linux kernel.

2

How do I fix CVE-2024-35871?

To remediate CVE-2024-35871, update your Linux kernel to a fixed version such as 5.10.223-1, 5.10.226-1, 6.1.123-1, 6.1.128-1, 6.12.12-1, or 6.12.16-1.

3

Which versions of Linux are affected by CVE-2024-35871?

CVE-2024-35871 affects specific versions of the Linux kernel prior to the updates issued in response to the vulnerability.

4

What type of vulnerability is CVE-2024-35871?

CVE-2024-35871 is an information leak vulnerability related to register handling within the RISC-V architecture of the Linux kernel.

5

Is CVE-2024-35871 related to user or kernel threads?

CVE-2024-35871 specifically addresses the management of kernel threads and their register states.

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