Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:btf_check_func_arg_match

Proto:int btf_check_func_arg_match(struct bpf_verifier_env *env, int subprog)

Type:int

Parameter:

TypeParameterName
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  If Not func_info Then Return 0
4062  btf_id = type_id
4063  If Not btf_id Then Return 0
4066  If unreliable Then Return 0
4069  t = btf_type_by_id(btf, btf_id)
4070  If Not t || Not btf_type_is_func(t) Then
4071  bpf_log(log, "BTF of subprog %d doesn't point to KIND_FUNC\n", subprog)
4073  Return -EINVAL
4075  tname = btf_name_by_offset(btf, name_off)
4077  t = btf_type_by_id(btf, type)
4078  If Not t || Not btf_type_is_func_proto(t) Then
4079  bpf_log(log, "Invalid type of func %s\n", tname)
4080  Return -EINVAL
4082  args = t + 1
4083  nargs = btf_type_vlen(t)
4084  If nargs > 5 Then
4085  bpf_log(log, "Function %s has %d > 5 args\n", tname, nargs)
4086  Go to out
4091  When i < nargs cycle
4092  t = btf_type_by_id(btf, type)
4093  When btf_type_is_modifier(t) cycle
4094  t = btf_type_by_id(btf, type)
4095  If btf_type_is_int(t) || btf_type_is_enum(t) Then
4098  bpf_log(log, "R%d is not a scalar\n", i + 1)
4099  Go to out
4101  If btf_type_is_ptr(t) Then
4103  bpf_log(log, "R%d is not a pointer\n", i + 1)
4104  Go to out
4113  Continue
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  Go to out
4119  Return 0
4120  out :
4122  bpf_log(log, "Type info disagrees with actual arguments due to compiler optimizations\n")
4124  unreliable = true
4125  Return 0
Caller
NameDescribe
check_func_call
do_check