Re: [PATCH bpf v5 0/2] bpf: Fix kfunc implicit arg injection and add selftest
From: Alexei Starovoitov
Date: Mon Jun 08 2026 - 16:01:30 EST
On Mon Jun 8, 2026 at 7:26 AM PDT, chenyuan_fl wrote:
> From: Yuan Chen <chenyuan@xxxxxxxxxx>
>
> v4: https://lore.kernel.org/bpf/20260602093836.2632714-1-chenyuan_fl@xxxxxxx/
>
> v1 made btf_types_are_same() cross-BTF aware by comparing kind, size
> and name. Alan Maguire pointed out that this would be too permissive
> since two different structs can share the same name and size.
>
> v2 used a name-based classifier (get_kfunc_arg_inject_type).
>
> v3 splits the combined is_kfunc_arg_ignore || is_kfunc_arg_implicit
> check in check_kfunc_args(), so that an implicit argument reaching
> is_kfunc_arg_implicit() without any prior handler is rejected with
> -EFAULT instead of silently skipped (Eduard Zingerman). This prevents
> the silent fallthrough that occurred when module BTF was inconsistent
> with vmlinux (e.g. pahole 1.30 breaking distilled base dedup).
>
> v4: fix a build error in the selftest.
>
> v5 changes:
> - Patch 1: extend the kfunc allow-list in check_kfunc_args() to cover
> all kfuncs with implicit args handled in bpf_fixup_kfunc_call():
> obj_new, percpu_obj_new, obj_drop, percpu_obj_drop,
> refcount_acquire, list_push, rbtree_add (Eduard Zingerman).
> - Patch 2: simplify the selftest by verifying aux->name in
> bpf_kfunc_implicit_arg() instead of adding a separate struct_ops
> test program with inline assembly (Eduard Zingerman). This is
> a single-file change exercised by the existing kfunc_implicit_args
> selftest.
Pls address feedback from Eduard and respin with [PATCH bpf-next v6] subject.
pw-bot: cr