Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\btf.c Create Date:2022-07-28 13:21:18
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:__btf_resolve_helper_id

Proto:static int __btf_resolve_helper_id(struct bpf_verifier_log *log, void *fn, int arg)

Type:int

Parameter:

TypeParameterName
struct bpf_verifier_log *log
void *fn
intarg
3881  fnname[( size of "%s+%#lx/%#lx [%s]" + (128 - 1) + 2 * (32 * 3 / 10) + ((64 - sizeof(unsignedlong)) - 1) + 1) + 4] = "btf_"
3887  If IS_ERR(btf_vmlinux) Then
3888  bpf_log(log, "btf_vmlinux is malformed\n")
3889  Return -EINVAL
3892  sym = Lookup an address* - modname is set to NULL if it's in the kernel.* - We guarantee that the returned name is valid until we reschedule even if.* It resides in a module.* - We also guarantee that modname will be valid until rescheduled.
3893  If Not sym Then
3894  bpf_log(log, "kernel doesn't have kallsyms\n")
3895  Return -EFAULT
3898  When i <= nr_types cycle
3899  t = btf_type_by_id(btf_vmlinux, i)
3900  If BTF_INFO_KIND( "info" bits arrangement * bits 0-15: vlen (e.g. # of struct's members) * bits 16-23: unused * bits 24-27: kind (e.g. int, ptr, array...etc) * bits 28-30: unused * bit 31: kind_flag, currently used by * struct, union and fwd) != Typedef Then Continue
3902  tname = __btf_name_by_offset(btf_vmlinux, name_off)
3903  If Not strcmp(tname, fnname) Then Break
3906  If i > nr_types Then
3907  bpf_log(log, "helper %s type is not found\n", fnname)
3908  Return -ENOENT
3911  t = btf_type_by_id(btf_vmlinux, type)
3912  If Not btf_type_is_ptr(t) Then Return -EFAULT
3914  t = btf_type_by_id(btf_vmlinux, type)
3915  If Not btf_type_is_func_proto(t) Then Return -EFAULT
3918  args = t + 1
3919  If arg >= btf_type_vlen(t) Then
3920  bpf_log(log, "bpf helper %s doesn't have %d-th argument\n", fnname, arg)
3922  Return -EINVAL
3925  t = btf_type_by_id(btf_vmlinux, type)
3926  If Not btf_type_is_ptr(t) || Not type Then
3928  bpf_log(log, "ARG_PTR_TO_BTF is misconfigured\n")
3929  Return -EFAULT
3931  btf_id = type
3932  t = btf_type_by_id(btf_vmlinux, type)
3934  When btf_type_is_modifier(t) cycle
3935  btf_id = type
3936  t = btf_type_by_id(btf_vmlinux, type)
3938  If Not is only a special case of struct:* all its offsetof(member) == 0 Then
3939  bpf_log(log, "ARG_PTR_TO_BTF is not a struct\n")
3940  Return -EFAULT
3942  bpf_log(log, "helper %s arg%d has btf_id %d struct %s\n", fnname + 4, arg, btf_id, __btf_name_by_offset(btf_vmlinux, name_off))
3944  Return btf_id
Caller
NameDescribe
btf_resolve_helper_id