函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:btf_check_func_arg_match

函数原型:int btf_check_func_arg_match(struct bpf_verifier_env *env, int subprog)

返回类型:int

参数:

类型参数名称
struct bpf_verifier_env *env
intsubprog
4048  st等于current verifier state
4049  func等于 call stack tracking [curframe]
4050  reg等于regs
4051  log等于log
4052  prog等于BPF program being verified
4053  btf等于btf
4059  如果非func_info则返回:0
4062  btf_id等于type_id
4063  如果非btf_id则返回:0
4066  如果unreliable则返回:0
4069  t等于btf_type_by_id(btf, btf_id)
4070  如果非t或非btf_type_is_func(t)则
4071  bpf_log(log, "BTF of subprog %d doesn't point to KIND_FUNC\n", subprog)
4073  返回:负EINVAL
4075  tname等于btf_name_by_offset(btf, name_off)
4077  t等于btf_type_by_id(btf, type)
4078  如果非t或非btf_type_is_func_proto(t)则
4079  bpf_log(log, "Invalid type of func %s\n", tname)
4080  返回:负EINVAL
4082  args等于t加1
4083  nargs等于btf_type_vlen(t)
4084  如果nargs大于5则
4085  bpf_log(log, "Function %s has %d > 5 args\n", tname, nargs)
4086  转到:out
4091 i小于nargs循环
4092  t等于btf_type_by_id(btf, type)
4093 btf_type_is_modifier(t)循环
4094  t等于btf_type_by_id(btf, type)
4095  如果btf_type_is_int(t)或btf_type_is_enum(t)则
4098  bpf_log(log, "R%d is not a scalar\n", i + 1)
4099  转到:out
4101  如果btf_type_is_ptr(t)则
4103  bpf_log(log, "R%d is not a pointer\n", i + 1)
4104  转到:out
4113  继续下一循环
4115  bpf_log(log, "Unrecognized argument type %s\n", btf_kind_str[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)])
4117  转到:out
4119  返回:0
4120  out :
4122  bpf_log(log, "Type info disagrees with actual arguments due to compiler optimizations\n")
4124  unreliable = true
4125  返回:0
调用者
名称描述
check_func_call
do_check