函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\btf.c Create Date:2022-07-27 14:38:57
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__btf_resolve_helper_id

函数原型:static int __btf_resolve_helper_id(struct bpf_verifier_log *log, void *fn, int arg)

返回类型:int

参数:

类型参数名称
struct bpf_verifier_log *log
void *fn
intarg
3881  fnname[("%s+%#lx/%#lx [%s]"的长度 + (128 - 1) + 2 * (32 * 3 / 10) + ((64 - sizeof(unsignedlong)) - 1) + 1) + 4]等于"btf_"
3887  如果是错误
3888  bpf_log(log, "btf_vmlinux is malformed\n")
3889  返回:负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  如果非sym
3894  bpf_log(log, "kernel doesn't have kallsyms\n")
3895  返回:负EFAULT
3898 i小于等于nr_types循环
3899  t等于btf_type_by_id(btf_vmlinux, i)
3900  如果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 则继续下一循环
3902  tname等于__btf_name_by_offset(btf_vmlinux, name_off)
3903  如果非字符串比较退出
3906  如果i大于nr_types
3907  bpf_log(log, "helper %s type is not found\n", fnname)
3908  返回:负ENOENT
3911  t等于btf_type_by_id(btf_vmlinux, type)
3912  如果非btf_type_is_ptr(t)则返回:负EFAULT
3914  t等于btf_type_by_id(btf_vmlinux, type)
3915  如果非btf_type_is_func_proto(t)则返回:负EFAULT
3918  args等于t加1
3919  如果arg大于等于btf_type_vlen(t)则
3920  bpf_log(log, "bpf helper %s doesn't have %d-th argument\n", fnname, arg)
3922  返回:负EINVAL
3925  t等于btf_type_by_id(btf_vmlinux, type)
3926  如果非btf_type_is_ptr(t)或非type
3928  bpf_log(log, "ARG_PTR_TO_BTF is misconfigured\n")
3929  返回:负EFAULT
3931  btf_id等于type
3932  t等于btf_type_by_id(btf_vmlinux, type)
3934 btf_type_is_modifier(t)循环
3935  btf_id等于type
3936  t等于btf_type_by_id(btf_vmlinux, type)
3938  如果非 is only a special case of struct:* all its offsetof(member) == 0
3939  bpf_log(log, "ARG_PTR_TO_BTF is not a struct\n")
3940  返回:负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  返回:btf_id
调用者
名称描述
btf_resolve_helper_id