Re: [PATCH v2 bpf-next 01/18] bpf: Add BTF ID sets for fmod_ret targets

From: Anton Protopopov

Date: Tue Nov 10 2026 - 09:06:21 EST


On 26/11/09 05:42PM, bot+bpf-ci@xxxxxxxxxx wrote:
> > bpf: Add BTF ID sets for fmod_ret targets
>
> TL;DR: Nits only in resolve_btfids: a comment may misleadingly suggest entries
> with a missing function are rejected (they only warn), and a new outer "off"
> is shadowed by the inner one.

Will fix both nits (will be resending series in any case, as verifier changed
again since then)

> > diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
> > --- a/tools/bpf/resolve_btfids/main.c
> > +++ b/tools/bpf/resolve_btfids/main.c
>
> [ ... ]
>
> > @@ -1344,7 +1355,16 @@ static bool is_arena_param(const struct btf *btf, const struct btf_param *param)
> > param_name_has_suffix(name, PARAM_SUFFIX_ARENA_NULLABLE);
> > }
> >
> > -static int collect_kfuncs(struct object *obj, struct btf2btf_context *ctx)
> > +typedef int (*set_func_fn)(struct btf2btf_context *ctx, const char *name,
> > + u32 btf_id, u32 flags);
> > +
> > +/*
> > + * Call FN for each function in the BTF ID sets which have SET_FLAG set. Reject
> > + * an entry with flags other than ALLOWED_FLAGS, also if its function is missing.
> > + */
>
> This isn't a bug, but could this read "even if its function is missing"?
> As written it can suggest that entries with a missing function are
> rejected, while collect_set_funcs() only prints a WARN, increments
> warnings and continues to the next entry.
>
> [ ... ]
>
> > @@ -1356,24 +1376,39 @@ static int collect_kfuncs(struct object *obj, struct btf2btf_context *ctx)
> > for (next = rb_first(&obj->sets); next; next = rb_next(next)) {
> > struct btf_id_set8 *set8;
> > struct btf_id *set_id;
> > - u64 set_addr;
> > + u64 set_addr, off;
>
> [ ... ]
>
> > for (u32 i = 0; i < set_id->cnt; i++) {
> > size_t off = (char *)&set8->pairs[i] - (char *)set8;
> > const char *name = find_name_by_addr(obj, set_addr + off);
>
> This isn't a bug, but would a distinct name for the new outer offset, for
> example set_off, make it clearer which offset "set_addr + off" uses here?
>
> The inner "size_t off" (offset of a pair within the set) now shadows the
> outer "off" (offset of the set within .BTF_ids), and the inner declaration
> would trigger -Wshadow.
>
>
> ---
> 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/42662799554