Thread (5 messages) 5 messages, 3 authors, 2d ago

Re: [PATCH bpf 1/2] bpf: Revalidate iterator programs on link update

flat view

From: bot+bpf-ci@kernel.org
Date: 2026-10-08 17:13:28
Also in: bpf, linux-kselftest, lkml

bpf: Revalidate iterator programs on link update
TL;DR: Nit only: Documentation/bpf/bpf_iterators.rst may need updating for the
new validate_target callback in struct bpf_iter_reg and for when it is invoked
(BPF_LINK_UPDATE only). No code problems reported.
quoted hunk ↗ jump to hunk
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 0ecb9418dfbd..5aa786eba3ea 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
[ ... ]
quoted hunk ↗ jump to hunk
@@ -3024,6 +3026,7 @@ enum bpf_iter_feature {
 struct bpf_iter_reg {
 	const char *target;
 	bpf_iter_attach_target_t attach_target;
+	bpf_iter_validate_target_t validate_target;
 	bpf_iter_detach_target_t detach_target;
 	bpf_iter_show_fdinfo_t show_fdinfo;
 	bpf_iter_fill_link_info_t fill_link_info;
This isn't a bug, but should Documentation/bpf/bpf_iterators.rst be updated
for the new member?

That file carries a copy of struct bpf_iter_reg that listed attach_target
and detach_target exactly as they appeared in this header before the patch:

    bpf_iter_attach_target_t attach_target;
    bpf_iter_detach_target_t detach_target;

It now lacks validate_target.

The field table in the same file also describes the callbacks as:

    attach_target and detach_target
      Allows for target specific link_create action since some targets may
      need special processing. Called during the user space link_create
      stage.

Nothing there says that validate_target is invoked only from
bpf_iter_link_replace() (BPF_LINK_UPDATE), and that a target's
attach_target has to call its validator itself at link_create time, since
bpf_iter_link_attach() does not call it generically.

A new iterator author working from the documentation would not learn that
program-dependent checks belong in validate_target as well as in
attach_target.

Should the struct listing and the field table describe validate_target and
when it is invoked?


---
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/37809581821
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help