函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:check_cond_jmp_op

函数原型:static int check_cond_jmp_op(struct bpf_verifier_env *env, struct bpf_insn *insn, int *insn_idx)

返回类型:int

参数:

类型参数名称
struct bpf_verifier_env *env
struct bpf_insn *insn
int *insn_idx
6044  this_branch等于current verifier state
6046  regs等于regs
6047  struct bpf_reg_state * dst_reg, * other_branch_regs, * src_reg = NULL
6048  opcode等于alu/jmp fields ( opcode )
6050  pred等于负1
6054  如果opcode恒等于BPF_JAopcode大于SLE is signed, '<='
6055  verbose(env, "invalid BPF_JMP/JMP32 opcode %x\n", opcode)
6056  返回:负EINVAL
6059  如果BPF_SRC( opcode )恒等于BPF_X
6060  如果 signed immediate constant 不等于0则
6061  verbose(env, "BPF_JMP/JMP32 uses reserved fields\n")
6062  返回:负EINVAL
6066  err等于check_reg_arg(env, source register , register is used as source operand )
6067  如果err则返回:err
6071  verbose(env, "R%d pointer comparison prohibited\n", source register )
6073  返回:负EACCES
6075  src_reg等于regs[ source register ]
6076  否则
6077  如果 source register 不等于BPF_REG_0
6078  verbose(env, "BPF_JMP/JMP32 uses reserved fields\n")
6079  返回:负EINVAL
6084  err等于check_reg_arg(env, dest register , register is used as source operand )
6085  如果err则返回:err
6088  dst_reg等于regs[ dest register ]
6089  is_jmp32等于Instruction classes ( opcode )恒等于jmp mode in word width
6091  如果BPF_SRC( opcode )恒等于BPF_Kpred等于mpute branch direction of the expression "if (reg opcode val) goto target;"* and return:* 1 - branch will be taken and "goto target" will be executed* 0 - branch will not be taken and fall-through to next insn* -1 - unknown
6094  否则如果 Ordering of fields matters. See states_equal() 恒等于g doesn't contain a valid pointer Returns true if @a is a known constant pred等于mpute branch direction of the expression "if (reg opcode val) goto target;"* and return:* 1 - branch will be taken and "goto target" will be executed* 0 - branch will not be taken and fall-through to next insn* -1 - unknown
6098  如果pred大于等于0则
6099  err等于mark_chain_precision(env, dest register )
6100  如果BPF_SRC( opcode )恒等于BPF_X且非errerr等于mark_chain_precision(env, source register )
6102  如果err则返回:err
6105  如果pred恒等于1则
6107  insn_idx加等于 signed offset
6108  返回:0
6109  否则如果pred恒等于0则
6113  返回:0
6116  other_branch等于push_stack(env, * insn_idx + signed offset + 1, * insn_idx, false)
6118  如果非other_branch则返回:负EFAULT
6120  other_branch_regs等于regs
6129  如果BPF_SRC( opcode )恒等于BPF_X
6130  src_reg等于regs[ source register ]
6131  lo_reg0等于dst_reg
6132  lo_reg1等于src_reg
6135  dst_lo等于lo_reg0
6136  src_lo等于lo_reg1
6137  runcate register to smaller size (in bytes)* must be called with size < BPF_REG_SIZE
6138  runcate register to smaller size (in bytes)* must be called with size < BPF_REG_SIZE
6165  否则如果 Ordering of fields matters. See states_equal() 恒等于g doesn't contain a valid pointer
6166  Adjusts the register min/max values in the case that the dst_reg is the* variable register that we are working on, and src_reg is a constant or we're* simply doing a BPF_K check.* In JEQ/JNE cases we also adjust the var_off values.
6174  如果非is_jmp32BPF_SRC( opcode )恒等于BPF_K signed immediate constant 恒等于0且opcode恒等于BPF_JEQopcode恒等于jump != 的值且reg_type_may_be_null( Ordering of fields matters. See states_equal() )则
6180  The logic is similar to find_good_pkt_pointers(), both could eventually* be folded together at some point.
6182  The logic is similar to find_good_pkt_pointers(), both could eventually* be folded together at some point.
6184  否则如果非try_match_pkt_pointers(insn, dst_reg, & regs[ source register ], this_branch, other_branch)且is_pointer_value(env, dest register )则
6187  verbose(env, "R%d pointer comparison prohibited\n", dest register )
6189  返回:负EACCES
6191  如果level按位与BPF_LOG_LEVELprint_verifier_state(env, call stack tracking [curframe])
6193  返回:0
调用者
名称描述
do_check