5.5medium
bpf: Fix exception exit lock checking for subprogs
- Severity
- 5.5medium CVSS:3.1 by NVD
- Exploit likelihood
- 0.13% (higher than 2% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: bpf: Fix exception exit lock checking for subprogs process_bpf_exit_full() passes check_lock = !curframe to check_resource_leak(), which is false in cases when bpf_throw() is called from a static subprog. This makes check_resource_leak() to skip validation of active_rcu_locks, active_preempt_locks, and active_irq_id on exception exits from subprogs. At runtime bpf_throw() unwinds the stack via ORC without releasing any user-acquired locks, which may cause various issues as the result. Fix by setting check_lock = true for exception exits regardless of curframe, since exceptions bypass all intermediate frame cleanup. Update the error message prefix to "bpf_throw" for exception exits to distinguish them from normal BPF_EXIT. Fix reject_subprog_with_rcu_read_lock test which was previously passing for the wrong reason. Test program returned directly from the subprog call without closing the RCU section, so the error was triggered by the unclosed RCU lock on normal exit, not by bpf_throw. Update __msg annotations for affected tests to match the new "bpf_throw" error prefix. The spin_lock case is not affected because they are already checked [1] at the call site in do_check_insn() before bpf_throw can run. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/bpf/verifier.c?h=v7.0-rc4#n21098
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from f18b03fabaa9b7c80e80b72a621f481f0d706ae0 before 4eca06a55417c3b2e538656d12c89e224343653e, from f18b03fabaa9b7c80e80b72a621f481f0d706ae0 before c0281da1f2aa5c2fca3a05f79b86bea96591c358, from f18b03fabaa9b7c80e80b72a621f481f0d706ae0 before 5a399f3117642494e35545f6ca397d3e177c1f9b, from f18b03fabaa9b7c80e80b72a621f481f0d706ae0 before 6c2128505f61b504c79a20b89596feba61388112, 6.7 Not affected: before 6.7, from 6.12.114 up to 6.12.*, from 6.18.21 up to 6.18.*, from 6.19.11 up to 6.19.*, from 7.0 up to * | CVE List |
| linux linux_kernel | from 6.7 before 6.18.21, from 6.19 before 6.19.11, 7.0 | NVD |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: bpf: Fix exception exit lock checking for subprogs process_bpf_exit_full() passes check_lock = !curframe to check_resource_leak(), which is false in cases when bpf_throw() is called from a static subprog. This makes check_resource_leak() to skip validation of active_rcu_locks, active_preempt_locks, and active_irq_id on exception exits from subprogs. At runtime bpf_throw() unwinds the stack via ORC without releasing any user-acquired locks, which may cause various issues as the result. Fix by setting check_lock = true for exception exits regardless of curframe, since exceptions bypass all intermediate frame cleanup. Update the error message prefix to "bpf_throw" for exception exits to distinguish them from normal BPF_EXIT. Fix reject_subprog_with_rcu_read_lock test which was previously passing for the wrong reason. Test program returned directly from the subprog call without closing the RCU section, so the error was triggered by the unclosed RCU lock on normal exit, not by bpf_throw. Update __msg annotations for affected tests to match the new "bpf_throw" error prefix. The spin_lock case is not affected because they are already checked [1] at the call site in do_check_insn() before bpf_throw can run. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/bpf/verifier.c?h=v7.0-rc4#n21098
NVD (es)
En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: bpf: Corrección de la comprobación de bloqueo en salida por excepción para subprogs process_bpf_exit_full() pasa check_lock = !curframe a check_resource_leak(), lo cual es falso en casos cuando se llama a bpf_throw() desde un subprog estático. Esto hace que check_resource_leak() omita la validación de active_rcu_locks, active_preempt_locks y active_irq_id en salidas por excepción desde subprogs. En tiempo de ejecución, bpf_throw() desenrolla la pila a través de ORC sin liberar ningún bloqueo adquirido por el usuario, lo cual puede causar varios problemas como resultado. Solución estableciendo check_lock = true para salidas por excepción independientemente de curframe, ya que las excepciones omiten toda la limpieza de marcos intermedios. Actualizar el prefijo del mensaje de error a ’bpf_throw’ para salidas por excepción para distinguirlas de un BPF_EXIT normal. Corrección de la prueba reject_subprog_with_rcu_read_lock que anteriormente pasaba por la razón equivocada. El programa de prueba regresó directamente de la llamada al subprog sin cerrar la sección RCU, por lo que el error fue activado por el bloqueo RCU no cerrado en una salida normal, no por bpf_throw. Actualizar las anotaciones __msg para las pruebas afectadas para que coincidan con el nuevo prefijo de error ’bpf_throw’. El caso spin_lock no se ve afectado porque ya se comprueban [1] en el sitio de llamada en do_check_insn() antes de que bpf_throw pueda ejecutarse. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/bpf/verifier.c?h=v7.0-rc4#n21098
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-31526 changed 2026-11-05 | CVE Terms of Use |
| NVD | CVE-2026-31526 changed 2026-11-11 | Public domain |