PT-2026-163366
CVE-2026-139325
·
Publicado
2026-11-30
·
Atualizado
2026-11-30
Descrição por
Pontuação
N/A
Não disponívelNão há classificações de severidade ou métricas disponíveis. Quando houver, atualizaremos as informações correspondentes na página.
In the Linux kernel, the following vulnerability has been resolved:
bpf: Forbid sleeping in hash map for each callbacks
A sleepable program (e.g. SEC("syscall"), lsm.s, fentry.s) can pass a
callback to bpf for each map elem() on a hash map and call a sleepable
helper or kfunc such as bpf copy from user() from it. The verifier
accepts this, but at run time the callback is invoked from inside an RCU
read-side critical section:
bpf for each hash elem()
rcu read lock();
callback fn(map, key, val, ctx, 0);
bpf copy from user() <- may fault and sleep
rcu read unlock();
bpf each rhash elem() does the same for BPF MAP TYPE RHASH. Sleeping
there triggers the "Voluntary context switch within RCU read-side
critical section!" warning, delays grace periods, and with
CONFIG PREEMPT RCU=n silently ends the read-side critical section that
the bucket walk relies on.
Synchronous callbacks are verified with the caller's state, so
kernel/bpf/verifier.c:in sleepable context() only looks at the program's
sleepability and the locks the program took itself, and does not know
that the helper holds rcu read lock() around the callback.
With a SEC("syscall") program whose callback reads a page that has to be
read from disk first:
BUG: sleeping function called from invalid context at include/linux/uaccess.h:169
RCU nest depth: 1, expected: 0
might fault+0x29/0x80
copy from user+0x26/0x90
bpf copy from user+0x23/0x60
bpf prog 17d44fa39eebd6cc cb+0x35/0x46
bpf for each hash elem+0xdb/0x280
Fix by marking the callback frame of hash map iteration as running under
RCU and making in sleepable context() false while such a frame is on the
call stack, so sleepable helpers, kfuncs and global functions are
rejected there as inside bpf rcu read lock(). The rules for trusting RCU
protected pointers are left alone, which is conservative and keeps
callbacks that verify today and do not sleep working. The flag is
compared in func states equal() so that pruning never mixes the two
contexts. Array map callbacks run without any lock and keep the caller's
context.
Encontrou algum problema na descrição? Tem algo a acrescentar? Fique à vontade para nos escrever 👾