Thread (59 messages) 59 messages, 4 authors, 2d ago

Re: [PATCH bpf-next v2 05/43] bpf: reject sleepable programs for task_vma iterator

flat view

From: bot+bpf-ci@kernel.org
Date: 2026-10-17 17:16:58
Also in: bpf

bpf: reject sleepable programs for task_vma iterator
TL;DR: Documentation nit only: bpf_iterators.rst still says only
BPF_ITER_RESCHED is supported and doesn't mention the new BPF_ITER_NOSLEEP
flag. No code problems raised.
quoted hunk ↗ jump to hunk
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 54144372281c..46d325aa178e 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -3137,7 +3137,8 @@ typedef const struct bpf_func_proto *
 			     const struct bpf_prog *prog);

 enum bpf_iter_feature {
-	BPF_ITER_RESCHED	= BIT(0),
+	BPF_ITER_RESCHED	= BIT(0),	/* may cond_resched() between objects */
+	BPF_ITER_NOSLEEP	= BIT(1),	/* ->show() can't run sleepable progs */
 };

 #define BPF_ITER_CTX_ARG_MAX 2
This isn't a bug, but should Documentation/bpf/bpf_iterators.rst be updated
for the new flag?

The description of the feature field in struct bpf_iter_reg still reads:

   * - feature
     - Specifies certain action requests in the kernel BPF iterator
       infrastructure. Currently, only BPF_ITER_RESCHED is supported. This
       means that the kernel function cond_resched() is called to avoid other
       kernel subsystem (e.g., rcu) misbehaving.

With BPF_ITER_NOSLEEP added, "only BPF_ITER_RESCHED is supported" is no
longer accurate.

The text also doesn't say that BPF_ITER_RESCHED is what allows a target to
accept sleepable (iter.s/) programs, or that a target whose ->show() runs
under a lock that a faulting program would need to take again (as task_vma
does with mmap_lock) has to set BPF_ITER_NOSLEEP as well.

Someone adding a new iterator target from that document would not learn
about the flag.  None of the later patches in this series touch
bpf_iterators.rst.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/39051545464
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help