5.5medium
slab: fix kmalloc_nolock() context check for PREEMPT_RT
- 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: slab: fix kmalloc_nolock() context check for PREEMPT_RT On PREEMPT_RT kernels, local_lock becomes a sleeping lock. The current check in kmalloc_nolock() only verifies we're not in NMI or hard IRQ context, but misses the case where preemption is disabled. When a BPF program runs from a tracepoint with preemption disabled (preempt_count > 0), kmalloc_nolock() proceeds to call local_lock_irqsave() which attempts to acquire a sleeping lock, triggering: BUG: sleeping function called from invalid context in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 6128 preempt_count: 2, expected: 0 Fix this by checking !preemptible() on PREEMPT_RT, which directly expresses the constraint that we cannot take a sleeping lock when preemption is disabled. This encompasses the previous checks for NMI and hard IRQ contexts while also catching cases where preemption is disabled.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from af92793e52c3a99b828ed4bdd277fd3e11c18d08 before f60ba4a97ae3f94e4818722ed2e4d260bbb17b44, from af92793e52c3a99b828ed4bdd277fd3e11c18d08 before 99a3e3a1cfc93b8fe318c0a3a5cfb01f1d4ad53c, 6.18 Not affected: before 6.18, from 6.18.8 up to 6.18.*, from 6.19 up to * | CVE List |
| linux linux_kernel | from 6.18 before 6.18.8, 6.19 | NVD |
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: slab: fix kmalloc_nolock() context check for PREEMPT_RT On PREEMPT_RT kernels, local_lock becomes a sleeping lock. The current check in kmalloc_nolock() only verifies we're not in NMI or hard IRQ context, but misses the case where preemption is disabled. When a BPF program runs from a tracepoint with preemption disabled (preempt_count > 0), kmalloc_nolock() proceeds to call local_lock_irqsave() which attempts to acquire a sleeping lock, triggering: BUG: sleeping function called from invalid context in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 6128 preempt_count: 2, expected: 0 Fix this by checking !preemptible() on PREEMPT_RT, which directly expresses the constraint that we cannot take a sleeping lock when preemption is disabled. This encompasses the previous checks for NMI and hard IRQ contexts while also catching cases where preemption is disabled.
NVD (es)
En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: slab: corrección de la verificación de contexto de kmalloc_nolock() para PREEMPT_RT En kernels PREEMPT_RT, local_lock se convierte en un bloqueo de suspensión. La verificación actual en kmalloc_nolock() solo verifica que no estamos en un contexto NMI o de IRQ dura, pero omite el caso en que la preemption está deshabilitada. Cuando un programa BPF se ejecuta desde un tracepoint con la preemption deshabilitada (preempt_count > 0), kmalloc_nolock() procede a llamar a local_lock_irqsave(), que intenta adquirir un bloqueo de suspensión, lo que desencadena: BUG: función de suspensión llamada desde contexto inválido in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 6128 preempt_count: 2, esperado: 0 Solucione esto verificando !preemptible() en PREEMPT_RT, lo que expresa directamente la restricción de que no podemos tomar un bloqueo de suspensión cuando la preemption está deshabilitada. Esto abarca las verificaciones anteriores para contextos NMI e IRQ dura, al mismo tiempo que detecta casos en los que la preemption está deshabilitada.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-23134 changed 2026-05-11 | CVE Terms of Use |
| NVD | CVE-2026-23134 changed 2026-06-17 | Public domain |