Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\verifier.c Create Date:2022-07-28 12:59:37
Last Modify:2022-05-19 20:02:10 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:check_func_call

Proto:static int check_func_call(struct bpf_verifier_env *env, struct bpf_insn *insn, int *insn_idx)

Type:int

Parameter:

TypeParameterName
struct bpf_verifier_env *env
struct bpf_insn *insn
int *insn_idx
3951  state = current verifier state
3955  If curframe + 1 >= MAX_CALL_FRAMES Then
3956  verbose(env, "the call stack of %d frames is too deep\n", curframe + 2)
3958  Return -E2BIG
3961  target_insn = insn_idx + signed immediate constant
3962  subprog = find_subprog(env, target_insn + 1)
3963  If subprog < 0 Then
3964  verbose(env, "verifier bug. No program starts at insn %d\n", target_insn + 1)
3966  Return -EFAULT
3969  caller = call stack tracking [curframe]
3970  If call stack tracking [curframe + 1] Then
3971  verbose(env, "verifier bug. Frame %d already allocated\n", curframe + 1)
3973  Return -EFAULT
3976  callee = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
3977  If Not callee Then Return -ENOMEM
3979  call stack tracking [curframe + 1] = callee
3985  init_func_state(env, callee, * insn_idx, curframe + 1, subprog)
3992  err = transfer_reference_state(callee, caller)
3993  If err Then Return err
3999  When i <= BPF_REG_5 cycle regs[i] = regs[i]
4003  When i < CALLER_SAVED_REGS cycle
4004  mark_reg_not_init(env, regs, caller_saved[i])
4005  check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK)
4009  curframe++
4011  If btf_check_func_arg_match(env, subprog) Then Return -EINVAL
4015  insn_idx = target_insn
4017  If level & BPF_LOG_LEVEL Then
4018  verbose(env, "caller:\n")
4019  print_verifier_state(env, caller)
4020  verbose(env, "callee:\n")
4021  print_verifier_state(env, callee)
4023  Return 0
Caller
NameDescribe
do_check