函数逻辑报告 |
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 |
注解内核,赢得工具 | 下载SCCT | English |
函数名称: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 |
9143 | insn_cnt等于 Number of filter blocks |
9149 | delta等于0 |
9156 | is64等于Instruction classes ( opcode )恒等于alu mode in double word width |
9165 | struct bpf_insn mask_and_mod[] = {BPF_MOV32_REG( source register , source register ), Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 (BPF_JEQ, source register , 0, 1), * insn, } |
9175 | patchlet等于mask_and_div加如果is64则1否则0 |
9177 | 否则 |
9178 | patchlet等于mask_and_mod加如果is64则1否则0 |
9187 | BPF program being verified 等于prog等于new_prog |
9189 | 继续下一循环 |
9192 | 如果Instruction classes ( opcode )恒等于BPF_LD且BPF BPF_DW 0x18 64-bit ( opcode )恒等于BPF_ABS或BPF BPF_DW 0x18 64-bit ( opcode )恒等于BPF_IND的值则 |
9211 | 如果 opcode 恒等于alu mode in double word width 按位或BPF_ADD按位或BPF_X的值或 opcode 恒等于alu mode in double word width 按位或BPF_SUB按位或BPF_X的值则 |
9213 | code_add等于alu mode in double word width 按位或BPF_ADD按位或BPF_X |
9214 | code_sub等于alu mode in double word width 按位或BPF_SUB按位或BPF_X |
9220 | aux等于array of per-insn state [i + delta] |
9221 | 如果非 used in combination with alu_limit 或 used in combination with alu_limit 恒等于BPF_ALU_NON_POINTER则继续下一循环 |
9226 | issrc等于 used in combination with alu_limit 按位与BPF_ALU_SANITIZE的值恒等于Possible states for alu_state member. |
9229 | off_reg等于如果issrc则 source register 否则 dest register |
9230 | 如果isneg则patch自加等于ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 (BPF_MUL, off_reg, - 1) |
9232 | patch自加等于BPF_MOV32_IMM(Kernel hidden auxiliary/helper register. , limit for add/sub register with pointer - 1) |
9233 | patch自加等于ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg (BPF_SUB, Kernel hidden auxiliary/helper register. , off_reg) |
9234 | patch自加等于ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg (BPF_OR, Kernel hidden auxiliary/helper register. , off_reg) |
9235 | patch自加等于ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 (BPF_NEG, Kernel hidden auxiliary/helper register. , 0) |
9236 | patch自加等于ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 (sign extending arithmetic shift right , Kernel hidden auxiliary/helper register. , 63) |
9237 | 如果issrc则 |
9241 | 否则 |
9249 | 如果issrc且isneg则patch自加等于ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 (BPF_MUL, off_reg, - 1) |
9258 | BPF program being verified 等于prog等于new_prog |
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 |
9274 | 如果 signed immediate constant 恒等于BPF_FUNC_tail_call则 |
9280 | Is control block accessed? 等于1 |
9282 | max_pkt_offset等于MAX_PACKET_OFF |
9289 | signed immediate constant 等于0 |
9292 | aux等于array of per-insn state [i + delta] |
9298 | struct bpf_jit_poke_descriptor desc = {reason = BPF_POKE_REASON_TAIL_CALL, map = BPF_MAP_PTR( pointer/poison value for maps ), key = bpf_map_key_immediate(aux), } |
9304 | ret等于bpf_jit_add_poke_descriptor(prog, & desc) |
9305 | 如果ret小于0则 |
9310 | signed immediate constant 等于ret加1 |
9311 | 继续下一循环 |
9314 | 如果非bpf_map_ptr_unpriv(aux)则继续下一循环 |
9323 | 如果bpf_map_ptr_poisoned(aux)则 |
9329 | insn_buf[0]等于Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 (BPF_JGE, BPF_REG_3, max_entries, 2) |
9331 | insn_buf[1]等于BPF_ALU32_IMM(BPF_AND, BPF_REG_3, index_mask) |
9336 | cnt等于3 |
9342 | BPF program being verified 等于prog等于new_prog |
9344 | 继续下一循环 |
9358 | aux等于array of per-insn state [i + delta] |
9359 | 如果bpf_map_ptr_poisoned(aux)则转到:patch_call_imm |
9363 | ops等于 The first two cachelines with read-mostly members of which some * are also accessed in fast-path (e.g. ops, max_entries). |
9366 | cnt等于map_gen_lookup(map_ptr, insn_buf) |
9378 | BPF program being verified 等于prog等于new_prog |
9380 | 继续下一循环 |
9383 | BUILD_BUG_ON - break compile if a condition is true(!Are two types/vars the same type (ignoring qualifiers)? (map_lookup_elem, (void * ( * )(structbpf_map * map, void * key))NULL)) |
9385 | BUILD_BUG_ON - break compile if a condition is true(!Are two types/vars the same type (ignoring qualifiers)? (map_delete_elem, (int( * )(structbpf_map * map, void * key))NULL)) |
9387 | BUILD_BUG_ON - break compile if a condition is true(!Are two types/vars the same type (ignoring qualifiers)? (map_update_elem, (int( * )(structbpf_map * map, void * key, void * value, u64prefix, newline flags ))NULL)) |
9390 | BUILD_BUG_ON - break compile if a condition is true(!Are two types/vars the same type (ignoring qualifiers)? (map_push_elem, (int( * )(structbpf_map * map, void * value, u64prefix, newline flags ))NULL)) |
9393 | BUILD_BUG_ON - break compile if a condition is true(!Are two types/vars the same type (ignoring qualifiers)? (map_pop_elem, (int( * )(structbpf_map * map, void * value))NULL)) |
9395 | BUILD_BUG_ON - break compile if a condition is true(!Are two types/vars the same type (ignoring qualifiers)? (map_peek_elem, (int( * )(structbpf_map * map, void * value))NULL)) |
9402 | 继续下一循环 |
9406 | 继续下一循环 |
9410 | 继续下一循环 |
9414 | 继续下一循环 |
9418 | 继续下一循环 |
9422 | 继续下一循环 |
9425 | 转到:patch_call_imm |
9428 | patch_call_imm : |
9433 | 如果非func则 |
9434 | verbose(env, "kernel subsystem misconfigured func %s#%d\n", func_id_name( signed immediate constant ), signed immediate constant ) |
9437 | 返回:负EFAULT |
9443 | 以i小于size_poke_tab循环 |
9445 | 如果非map_poke_track或非map_poke_untrack或非map_poke_run则 |
9452 | ret等于map_poke_track(map_ptr, Auxiliary fields ) |
9453 | 如果ret小于0则 |
9459 | 返回:0 |
名称 | 描述 |
---|---|
bpf_check |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |