函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\verifier.c Create Date:2022-07-27 14:19:49
Last Modify:2022-05-19 20:02:10 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:jit_subprogs

函数原型:static int jit_subprogs(struct bpf_verifier_env *env)

返回类型:int

参数:

类型参数名称
struct bpf_verifier_env *env
8928  prog等于BPF program being verified
8929  subprog_end等于0
8934  如果subprog_cnt小于等于1则返回:0
8937 i小于 Number of filter blocks 循环
8938  如果 opcode 不等于BPF_JMP按位或unction call 的值或 source register 不等于when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative* offset to another bpf function则继续下一循环
8945  subprog等于find_subprog(env, i + signed immediate constant + 1)
8946  如果subprog小于0则
8947  WARN_ONCE(1, "verifier bug. No program starts at insn %d\n", i + signed immediate constant + 1)
8949  返回:负EFAULT
8954  signed offset 等于subprog
8958  saved imm field of call insn 等于 signed immediate constant
8960  signed immediate constant 等于1
8963  err等于bpf_prog_alloc_jited_linfo(prog)
8964  如果err则转到:out_undo_insn
8967  err等于负ENOMEM
8968  func等于分配数组内存并置零
8969  如果非func则转到:out_undo_insn
8972 i小于subprog_cnt循环
8973  subprog_start等于subprog_end
8974  subprog_end等于 insn idx of function entry point
8976  len等于subprog_endsubprog_start
8982  func[i]等于bpf_prog_alloc_no_stats(bpf_prog_size(len), GFP_USER)
8983  如果非func[i]则转到:out_free
8985  内存复制(insnsi, & insnsi[subprog_start], len * sizeof(structbpf_insn))
8987  Type of BPF program 等于 Type of BPF program
8988  Number of filter blocks 等于len
8989  如果bpf_prog_calc_tag(func[i])则转到:out_free
8991  program is a bpf function 等于1
8992  0 for non-func prog, the index in func array for func prog 等于i
8994  btf等于btf
8995  func_info等于func_info
9000  name[0]等于'F'
9001  stack_depth等于 max. stack depth used by this function
9002  archs need to JIT the prog 等于1
9003  bpf_line_info loaded from userspace. linfo->insn_off * has the xlated insn offset. * Both the main and sub prog share the same linfo. * The subprog can access its first linfo by * using the linfo_idx.等于 bpf_line_info loaded from userspace. linfo->insn_off * has the xlated insn offset. * Both the main and sub prog share the same linfo. * The subprog can access its first linfo by * using the linfo_idx.
9004  nr_linfo等于nr_linfo
9005  jited_linfo is the jited addr of the linfo. It has a * one to one mapping to linfo: * jited_linfo[i] is the jited addr for the linfo[i]->insn_off. * Both the main and sub prog share the same jited_linfo. * The subprog can access its first jited_linfo by *等于 jited_linfo is the jited addr of the linfo. It has a * one to one mapping to linfo: * jited_linfo[i] is the jited addr for the linfo[i]->insn_off. * Both the main and sub prog share the same jited_linfo. * The subprog can access its first jited_linfo by *
9006  subprog can use linfo_idx to access its first linfo and * jited_linfo. * main prog always has linfo_idx == 0等于 The idx to the main_prog->aux->linfo
9007  func[i]等于Stub for JITs that only support cBPF. eBPF programs are interpreted.* It is encouraged to implement bpf_int_jit_compile() instead, so that* eBPF and implicitly also cBPF can get JITed!
9008  如果非 Is our filter JIT'ed?
9010  转到:out_free
9012  cond_resched()
9018 i小于subprog_cnt循环
9019  insn等于insnsi
9040  func等于func
9041  used by non-func prog as the number of func progs 等于subprog_cnt
9043 i小于subprog_cnt循环
9044  old_bpf_func等于bpf_func
9045  tmp等于Stub for JITs that only support cBPF. eBPF programs are interpreted.* It is encouraged to implement bpf_int_jit_compile() instead, so that* eBPF and implicitly also cBPF can get JITed!
9046  如果tmp不等于func[i]或bpf_func不等于old_bpf_func
9047  verbose(env, "JIT doesn't support bpf-to-bpf calls\n")
9049  转到:out_free
9051  cond_resched()
9057 i小于subprog_cnt循环
9058  bpf_prog_lock_ro(func[i])
9059  bpf_prog_kallsyms_add(func[i])
9066 i小于 Number of filter blocks 循环
9067  如果 opcode 不等于BPF_JMP按位或unction call 的值或 source register 不等于when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative* offset to another bpf function则继续下一循环
9070  signed offset 等于 saved imm field of call insn
9071  subprog等于find_subprog(env, i + signed offset + 1)
9072  signed immediate constant 等于subprog
9075  Is our filter JIT'ed? 等于1
9076  bpf_func等于bpf_func
9077  func等于func
9078  used by non-func prog as the number of func progs 等于subprog_cnt
9079  bpf_prog_free_unused_jited_linfo(prog)
9080  返回:0
9081  out_free :
9082 i小于subprog_cnt循环如果func[i]则
9084  bpf_jit_free(func[i])
9085  kfree(func)
9086  out_undo_insn :
9088  archs need to JIT the prog 等于0
9089 i小于 Number of filter blocks 循环
9090  如果 opcode 不等于BPF_JMP按位或unction call 的值或 source register 不等于when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative* offset to another bpf function则继续下一循环
9093  signed offset 等于0
9094  signed immediate constant 等于 saved imm field of call insn
9096  bpf_prog_free_jited_linfo(prog)
9097  返回:err
调用者
名称描述
fixup_call_args