函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:xup insn->imm field of bpf_call instructions* and inline eligible helpers as explicit sequence of BPF instructions* this function is called after eBPF program passed verification

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

返回类型:int

参数:

类型参数名称
struct bpf_verifier_env *env
9139  prog等于BPF program being verified
9140  expect_blinding等于bpf_jit_blinding_enabled(prog)
9141  insn等于insnsi
9143  insn_cnt等于 Number of filter blocks
9149  delta等于0
9151 i小于insn_cnt循环
9152  如果 opcode 恒等于alu mode in double word width 按位或BPF_MOD按位或BPF_X的值或 opcode 恒等于alu mode in double word width 按位或BPF_DIV按位或BPF_X的值或 opcode 恒等于BPF_ALU按位或BPF_MOD按位或BPF_X的值或 opcode 恒等于BPF_ALU按位或BPF_DIV按位或BPF_X的值则
9173  如果 opcode 恒等于alu mode in double word width 按位或BPF_DIV按位或BPF_X的值或 opcode 恒等于BPF_ALU按位或BPF_DIV按位或BPF_X的值则
9177  否则
9183  如果非new_prog则返回:负ENOMEM
9186  delta加等于cnt减1
9188  insn等于insnsiidelta
9189  继续下一循环
9195  cnt等于gen_ld_abs(insn, insn_buf)
9197  verbose(env, "bpf verifier is misconfigured\n")
9198  返回:负EINVAL
9202  如果非new_prog则返回:负ENOMEM
9205  delta加等于cnt减1
9207  insn等于insnsiidelta
9208  继续下一循环
9211  如果 opcode 恒等于alu mode in double word width 按位或BPF_ADD按位或BPF_X的值或 opcode 恒等于alu mode in double word width 按位或BPF_SUB按位或BPF_X的值则
9216  patch等于insn_buf[0]
9237  如果issrc
9241  否则
9245  如果isneg opcode 等于如果 opcode 恒等于code_addcode_sub否则code_add
9248  patch自加等于insn
9251  cnt等于patchinsn_buf
9254  如果非new_prog则返回:负ENOMEM
9257  delta加等于cnt减1
9259  insn等于insnsiidelta
9260  继续下一循环
9263  如果 opcode 不等于BPF_JMP按位或unction call 的值则继续下一循环
9265  如果 source register 恒等于when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative* offset to another bpf function则继续下一循环
9268  如果 signed immediate constant 恒等于BPF_FUNC_get_route_realm Do we need dst entry? 等于1
9270  如果 signed immediate constant 恒等于BPF_FUNC_get_prandom_u32bpf_user_rnd_init_once()
9272  如果 signed immediate constant 恒等于BPF_FUNC_override_return Do we override a kprobe? 等于1
9305  如果ret小于0则
9306  verbose(env, "adding tail call poke descriptor failed\n")
9307  返回:ret
9311  继续下一循环
9314  如果非bpf_map_ptr_unpriv(aux)则继续下一循环
9323  如果bpf_map_ptr_poisoned(aux)则
9324  verbose(env, "tail_call abusing map_ptr\n")
9325  返回:负EINVAL
9335  insn_buf[2]等于insn
9336  cnt等于3
9338  如果非new_prog则返回:负ENOMEM
9341  delta加等于cnt减1
9343  insn等于insnsiidelta
9344  继续下一循环
9359  如果bpf_map_ptr_poisoned(aux)则转到:patch_call_imm
9368  verbose(env, "bpf verifier is misconfigured\n")
9369  返回:负EINVAL
9374  如果非new_prog则返回:负ENOMEM
9377  delta加等于cnt减1
9379  insn等于insnsiidelta
9380  继续下一循环
9425  转到:patch_call_imm
9428  patch_call_imm :
9429  fn等于get_func_proto( signed immediate constant , BPF program being verified )
9433  如果非func
9434  verbose(env, "kernel subsystem misconfigured func %s#%d\n", func_id_name( signed immediate constant ), signed immediate constant )
9437  返回:负EFAULT
9439  signed immediate constant 等于funcBase function for offset calculation. Needs to go into .text section,* therefore keeping it non-static as well; will also be used by JITs* anyway later on, so do not let the compiler omit it. This also needs* to go into kallsyms for correlation from e
9443 i小于size_poke_tab循环
9444  map_ptr等于map
9445  如果非map_poke_track或非map_poke_untrack或非map_poke_run
9448  verbose(env, "bpf verifier is misconfigured\n")
9449  返回:负EINVAL
9452  ret等于map_poke_track(map_ptr, Auxiliary fields )
9453  如果ret小于0则
9454  verbose(env, "tracking tail call prog failed\n")
9455  返回:ret
9459  返回:0
调用者
名称描述
bpf_check