bpf: Support struct btf_struct_meta via KF_IMPLICIT_ARGS#11385
bpf: Support struct btf_struct_meta via KF_IMPLICIT_ARGS#11385kernel-patches-daemon-bpf[bot] wants to merge 2 commits intobpf-next_basefrom
Conversation
|
Upstream branch: ca0f39a |
AI reviewed your patch. Please fix the bug or email reply why it's not a bug. In-Reply-To-Subject: |
AI reviewed your patch. Please fix the bug or email reply why it's not a bug. In-Reply-To-Subject: |
|
Forwarding comment 4049639337 via email |
|
Forwarding comment 4049653995 via email |
15b24d7 to
43a1b48
Compare
|
Upstream branch: bb41fce |
1cf4384 to
22c85c3
Compare
43a1b48 to
912a12b
Compare
|
Upstream branch: bb41fce |
22c85c3 to
d8e71bc
Compare
912a12b to
71c9f15
Compare
|
Upstream branch: 202e42e |
d8e71bc to
8cd18b7
Compare
71c9f15 to
45bc2d7
Compare
|
Upstream branch: 6c8e1a9 |
8cd18b7 to
164a4e5
Compare
45bc2d7 to
1e267ee
Compare
|
Upstream branch: 2364959 |
164a4e5 to
0dd7729
Compare
1e267ee to
52ba927
Compare
|
Upstream branch: 2364959 |
0dd7729 to
6df053a
Compare
52ba927 to
75c8856
Compare
|
Upstream branch: 2364959 |
6df053a to
01fa341
Compare
75c8856 to
6f71402
Compare
|
Upstream branch: 2364959 |
01fa341 to
a6a5e8e
Compare
6f71402 to
3aabcc8
Compare
|
Upstream branch: 2364959 |
a6a5e8e to
2297840
Compare
3aabcc8 to
fa794bf
Compare
|
Upstream branch: 77378da |
2297840 to
760248d
Compare
fa794bf to
6e67145
Compare
|
Upstream branch: 77378da |
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>
760248d to
062be47
Compare
Pull request for series with
subject: bpf: Support struct btf_struct_meta via KF_IMPLICIT_ARGS
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1065888