mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
bpf: Use KF_FASTCALL to mark kfuncs supporting fastcall contract
In order to allow pahole add btf_decl_tag("bpf_fastcall") for kfuncs
supporting bpf_fastcall, mark such functions with KF_FASTCALL in
id_set8 objects.
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240916091712.2929279-4-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Alexei Starovoitov
parent
4f647a780f
commit
da7d71bcb0
@@ -75,6 +75,7 @@
|
||||
#define KF_ITER_NEXT (1 << 9) /* kfunc implements BPF iter next method */
|
||||
#define KF_ITER_DESTROY (1 << 10) /* kfunc implements BPF iter destructor */
|
||||
#define KF_RCU_PROTECTED (1 << 11) /* kfunc should be protected by rcu cs when they are invoked */
|
||||
#define KF_FASTCALL (1 << 12) /* kfunc supports bpf_fastcall protocol */
|
||||
|
||||
/*
|
||||
* Tag marking a kernel function as a kfunc. This is meant to minimize the
|
||||
|
||||
@@ -3052,8 +3052,8 @@ BTF_ID(func, bpf_cgroup_release_dtor)
|
||||
#endif
|
||||
|
||||
BTF_KFUNCS_START(common_btf_ids)
|
||||
BTF_ID_FLAGS(func, bpf_cast_to_kern_ctx)
|
||||
BTF_ID_FLAGS(func, bpf_rdonly_cast)
|
||||
BTF_ID_FLAGS(func, bpf_cast_to_kern_ctx, KF_FASTCALL)
|
||||
BTF_ID_FLAGS(func, bpf_rdonly_cast, KF_FASTCALL)
|
||||
BTF_ID_FLAGS(func, bpf_rcu_read_lock)
|
||||
BTF_ID_FLAGS(func, bpf_rcu_read_unlock)
|
||||
BTF_ID_FLAGS(func, bpf_dynptr_slice, KF_RET_NULL)
|
||||
|
||||
@@ -16176,10 +16176,7 @@ static u32 kfunc_fastcall_clobber_mask(struct bpf_kfunc_call_arg_meta *meta)
|
||||
/* Same as verifier_inlines_helper_call() but for kfuncs, see comment above */
|
||||
static bool is_fastcall_kfunc_call(struct bpf_kfunc_call_arg_meta *meta)
|
||||
{
|
||||
if (meta->btf == btf_vmlinux)
|
||||
return meta->func_id == special_kfunc_list[KF_bpf_cast_to_kern_ctx] ||
|
||||
meta->func_id == special_kfunc_list[KF_bpf_rdonly_cast];
|
||||
return false;
|
||||
return meta->kfunc_flags & KF_FASTCALL;
|
||||
}
|
||||
|
||||
/* LLVM define a bpf_fastcall function attribute.
|
||||
|
||||
Reference in New Issue
Block a user