History

bpf: Fix configuration-dependent BTF function references

These BTF functions are not available unconditionally, only reference them when they are available. Avoid the following build warnings: BTF .tmp_vmlinux1.btf.o btf_encoder__tag_kfunc: failed to find kfunc 'bpf_send_signal_task' in BTF btf_encoder__tag_kfuncs: failed to tag kfunc 'bpf_send_signal_task' NM .tmp_vmlinux1.syms KSYMS .tmp_vmlinux1.kallsyms.S AS .tmp_vmlinux1.kallsyms.o LD .tmp_vmlinux2 NM .tmp_vmlinux2.syms KSYMS .tmp_vmlinux2.kallsyms.S AS .tmp_vmlinux2.kallsyms.o LD vmlinux BTFIDS vmlinux WARN: resolve_btfids: unresolved symbol prog_test_ref_kfunc WARN: resolve_btfids: unresolved symbol bpf_crypto_ctx WARN: resolve_btfids: unresolved symbol bpf_send_signal_task WARN: resolve_btfids: unresolved symbol bpf_modify_return_test_tp WARN: resolve_btfids: unresolved symbol bpf_dynptr_from_xdp WARN: resolve_btfids: unresolved symbol bpf_dynptr_from_skb

Thomas Weißschuh committed 1 year ago

Commit 00a5acd1 parent 3d1af4b2 files · +12 −0Browse files

Unified · Split

2 files
  1. kernel/bpf/helpers.c +4 −0
  2. kernel/bpf/verifier.c +8 −0
kernel/bpf/helpers.c+4−0
@@ -3104,7 +3104,9 @@ BTF_ID_FLAGS(func, bpf_task_get_cgroup1, KF_ACQUIRE | KF_RCU | KF_RET_NULL) · 3103 unmodified lines
3104BTF_ID_FLAGS(func, bpf_task_from_pid, KF_ACQUIRE | KF_RET_NULL)3104BTF_ID_FLAGS(func, bpf_task_from_pid, KF_ACQUIRE | KF_RET_NULL)
3105BTF_ID_FLAGS(func, bpf_task_from_vpid, KF_ACQUIRE | KF_RET_NULL)3105BTF_ID_FLAGS(func, bpf_task_from_vpid, KF_ACQUIRE | KF_RET_NULL)
3106BTF_ID_FLAGS(func, bpf_throw)3106BTF_ID_FLAGS(func, bpf_throw)
3107#ifdef CONFIG_BPF_EVENTS
3107BTF_ID_FLAGS(func, bpf_send_signal_task, KF_TRUSTED_ARGS)3108BTF_ID_FLAGS(func, bpf_send_signal_task, KF_TRUSTED_ARGS)
3109#endif
3108BTF_KFUNCS_END(generic_btf_ids)3110BTF_KFUNCS_END(generic_btf_ids)
3109 3111
3110static const struct btf_kfunc_id_set generic_kfunc_set = {3112static const struct btf_kfunc_id_set generic_kfunc_set = {
@@ -3150,7 +3152,9 @@ BTF_ID_FLAGS(func, bpf_dynptr_is_null) · 39 unmodified lines
3150BTF_ID_FLAGS(func, bpf_dynptr_is_rdonly)3152BTF_ID_FLAGS(func, bpf_dynptr_is_rdonly)
3151BTF_ID_FLAGS(func, bpf_dynptr_size)3153BTF_ID_FLAGS(func, bpf_dynptr_size)
3152BTF_ID_FLAGS(func, bpf_dynptr_clone)3154BTF_ID_FLAGS(func, bpf_dynptr_clone)
3155#ifdef CONFIG_NET
3153BTF_ID_FLAGS(func, bpf_modify_return_test_tp)3156BTF_ID_FLAGS(func, bpf_modify_return_test_tp)
3157#endif
3154BTF_ID_FLAGS(func, bpf_wq_init)3158BTF_ID_FLAGS(func, bpf_wq_init)
3155BTF_ID_FLAGS(func, bpf_wq_set_callback_impl)3159BTF_ID_FLAGS(func, bpf_wq_set_callback_impl)
3156BTF_ID_FLAGS(func, bpf_wq_start)3160BTF_ID_FLAGS(func, bpf_wq_start)
kernel/bpf/verifier.c+8−0
@@ -5681,7 +5681,9 @@ static bool in_rcu_cs(struct bpf_verifier_env *env) · 5680 unmodified lines
5681 5681
5682/* Once GCC supports btf_type_tag the following mechanism will be replaced with tag check */5682/* Once GCC supports btf_type_tag the following mechanism will be replaced with tag check */
5683BTF_SET_START(rcu_protected_types)5683BTF_SET_START(rcu_protected_types)
5684#ifdef CONFIG_NET
5684BTF_ID(struct, prog_test_ref_kfunc)5685BTF_ID(struct, prog_test_ref_kfunc)
5686#endif
5685#ifdef CONFIG_CGROUPS5687#ifdef CONFIG_CGROUPS
5686BTF_ID(struct, cgroup)5688BTF_ID(struct, cgroup)
5687#endif5689#endif
@@ -5689,7 +5691,9 @@ BTF_ID(struct, cgroup) · 1 unmodified line
5689BTF_ID(struct, bpf_cpumask)5691BTF_ID(struct, bpf_cpumask)
5690#endif5692#endif
5691BTF_ID(struct, task_struct)5693BTF_ID(struct, task_struct)
5694#ifdef CONFIG_CRYPTO
5692BTF_ID(struct, bpf_crypto_ctx)5695BTF_ID(struct, bpf_crypto_ctx)
5696#endif
5693BTF_SET_END(rcu_protected_types)5697BTF_SET_END(rcu_protected_types)
5694 5698
5695static bool rcu_protected_object(const struct btf *btf, u32 btf_id)5699static bool rcu_protected_object(const struct btf *btf, u32 btf_id)
@@ -11722,8 +11726,10 @@ BTF_ID(func, bpf_rdonly_cast) · 6026 unmodified lines
11722BTF_ID(func, bpf_rbtree_remove)11726BTF_ID(func, bpf_rbtree_remove)
11723BTF_ID(func, bpf_rbtree_add_impl)11727BTF_ID(func, bpf_rbtree_add_impl)
11724BTF_ID(func, bpf_rbtree_first)11728BTF_ID(func, bpf_rbtree_first)
11729#ifdef CONFIG_NET
11725BTF_ID(func, bpf_dynptr_from_skb)11730BTF_ID(func, bpf_dynptr_from_skb)
11726BTF_ID(func, bpf_dynptr_from_xdp)11731BTF_ID(func, bpf_dynptr_from_xdp)
11732#endif
11727BTF_ID(func, bpf_dynptr_slice)11733BTF_ID(func, bpf_dynptr_slice)
11728BTF_ID(func, bpf_dynptr_slice_rdwr)11734BTF_ID(func, bpf_dynptr_slice_rdwr)
11729BTF_ID(func, bpf_dynptr_clone)11735BTF_ID(func, bpf_dynptr_clone)
@@ -11751,8 +11757,10 @@ BTF_ID(func, bpf_rcu_read_unlock) · 21 unmodified lines
11751BTF_ID(func, bpf_rbtree_remove)11757BTF_ID(func, bpf_rbtree_remove)
11752BTF_ID(func, bpf_rbtree_add_impl)11758BTF_ID(func, bpf_rbtree_add_impl)
11753BTF_ID(func, bpf_rbtree_first)11759BTF_ID(func, bpf_rbtree_first)
11760#ifdef CONFIG_NET
11754BTF_ID(func, bpf_dynptr_from_skb)11761BTF_ID(func, bpf_dynptr_from_skb)
11755BTF_ID(func, bpf_dynptr_from_xdp)11762BTF_ID(func, bpf_dynptr_from_xdp)
11763#endif
11756BTF_ID(func, bpf_dynptr_slice)11764BTF_ID(func, bpf_dynptr_slice)
11757BTF_ID(func, bpf_dynptr_slice_rdwr)11765BTF_ID(func, bpf_dynptr_slice_rdwr)
11758BTF_ID(func, bpf_dynptr_clone)11766BTF_ID(func, bpf_dynptr_clone)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t