bpf: Support struct btf_struct_meta via KF_IMPLICIT_ARGS#11468
bpf: Support struct btf_struct_meta via KF_IMPLICIT_ARGS#11468kernel-patches-daemon-bpf[bot] wants to merge 3 commits intobpf-next_basefrom
Conversation
|
Upstream branch: 77378da |
6e67145 to
c0ba5e6
Compare
|
Upstream branch: 888329b |
c594770 to
b1f79d2
Compare
c0ba5e6 to
9f8e178
Compare
|
Upstream branch: 4a4fedb |
b1f79d2 to
c74eb91
Compare
9f8e178 to
1857029
Compare
|
Upstream branch: 350de5b |
c74eb91 to
afd3429
Compare
1857029 to
c0c253d
Compare
|
Upstream branch: 4b21ea5 |
afd3429 to
7a2603b
Compare
|
Upstream branch: 4b21ea5 |
7a2603b to
48b5609
Compare
c0c253d to
bcc2ccd
Compare
|
Upstream branch: 21337b5 |
The following kfuncs currently accept void *meta__ign argument: * bpf_obj_new_impl * bpf_obj_drop_impl * bpf_percpu_obj_new_impl * bpf_percpu_obj_drop_impl * bpf_refcount_acquire_impl * bpf_list_push_front_impl * bpf_rbtree_add_impl The __ign suffix is an indicator for the verifier to skip the argument in check_kfunc_args(). Then, in fixup_kfunc_call() the verifier may set the value of this argument to struct btf_struct_meta * kptr_struct_meta from insn_aux_data. BPF programs must pass a dummy NULL value when caling these kfuncs. Additionally, the list and rbtree _impl kfuncs also accept an implicit u64 argument, which doesn't require __ign suffix because it's a scalar, and BPF programs explicitly pass 0. Add new kfuncs with KF_IMPLICIT_ARGS [1], that correspond to each _impl kfunc accepting meta__ign. The existing _impl kfuncs remain unchanged for backwards compatibility. To support this, add "btf_struct_meta" to the list of recognized implicit argument types in resolve_btfids. Implement is_kfunc_arg_implicit() in the verifier, that determines implicit args by inspecting both (_impl and non-_impl) BTF prototypes of the kfunc. Update the special_kfunc_list in the verifier and relevant checks to support both the old _impl and the new KF_IMPLICIT_ARGS variants of btf_struct_meta users. [1] https://lore.kernel.org/bpf/20260120222638.3976562-1-ihor.solodrai@linux.dev/ Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Update selftests to use the new non-_impl kfuncs marked with KF_IMPLICIT_ARGS by removing redundant declarations and macros from bpf_experimental.h (the new kfuncs are present in the vmlinux.h) and updating relevant callsites. Fix spin_lock verifier-log matching for lock_id_kptr_preserve by accepting variable instruction numbers. The calls to kfuncs with implicit arguments do not have register moves (e.g. r5 = 0) corresponding to dummy arguments anymore, so the order of instructions has shifted. Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev> Acked-by: Mykyta Yatsenko <yatsenko@meta.com>
48b5609 to
5b9d707
Compare
bcc2ccd to
5da949e
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1068916 expired. Closing PR. |
Pull request for series with
subject: bpf: Support struct btf_struct_meta via KF_IMPLICIT_ARGS
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1068916