Thread (17 messages) 17 messages, 4 authors, 5d ago

Re: [PATCH bpf-next v4 3/7] libbpf: Support declarative manual load via SEC("!...") prefix

From: sashiko-bot@kernel.org
Date: 2026-09-21 23:12:35

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] libbpf: BPF multi-line comment style violation in bpf_object__init_prog()
- [Low] libbpf: comment references non-existent bpf_program__load_manually() API
--

commit ad283ccfb2e02481009ae746b5802475a68fb97e
Author: Andrey Grodzovsky [off-list ref]

libbpf: Support declarative manual load via SEC("!...") prefix
    
Add a SEC("!...") section-name prefix, letting a program declare itself
manually-loaded in its source instead of requiring an imperative
bpf_program__set_load_strategy() call. The prefix is recognized and stripped in
bpf_object__init_prog(), directly setting the load_strategy to MANUAL.
quoted hunk ↗ jump to hunk
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 939f0d6378e38..476172933a1fc 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -892,16 +892,25 @@ bpf_object__init_prog(struct bpf_object *obj, struct bpf_program *prog,
 	/* libbpf's convention for SEC("?abc...") is that it's just like
 	 * SEC("abc...") but the corresponding bpf_program starts out with
 	 * autoload set to false.
[Severity: Low]
This isn't a functional bug, but the BPF subsystem guidelines strictly require
all multi-line comments in tools/lib/bpf/ to place the opening /* on its own
line. Since this patch expands the comment block to document the new SEC("!...")
prefix, should the opening /* be moved to its own line to align with the
formatting standards?
+	 *
+	 * Similarly, SEC("!abc...") marks the program for manual loading:
+	 * it is skipped by the bulk auto-load pass and must be explicitly
+	 * loaded later via bpf_program__load_manually().
[Severity: Low]
Is this comment accurate? It references bpf_program__load_manually(), but there
is no such function in the libbpf API. Should this reference bpf_program__load()
instead?
 	 */
 	if (sec_name[0] == '?') {
 		prog->load_strategy = BPF_PROG_LOAD_STRATEGY_DISABLED;
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260921223937.3203093-1-andrey.grodzovsky@crowdstrike.com?part=3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help