函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:WARNING: This function does calculations on 64-bit values, but the actual* execution may occur on 32-bit values. Therefore, things like bitshifts* need extra checks in the 32-bit case.

函数原型:static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env, struct bpf_insn *insn, struct bpf_reg_state *dst_reg, struct bpf_reg_state src_reg)

返回类型:int

参数:

类型参数名称
struct bpf_verifier_env *env
struct bpf_insn *insn
struct bpf_reg_state *dst_reg
struct bpf_reg_statesrc_reg
4808  regs等于cur_regs(env)
4809  opcode等于alu/jmp fields ( opcode )
4813  insn_bitness等于如果Instruction classes ( opcode )恒等于alu mode in double word width 则64否则32
4814  dst等于 dest register
4817  如果insn_bitness恒等于32则
4822  runcate register to smaller size (in bytes)* must be called with size < BPF_REG_SIZE
4823  runcate register to smaller size (in bytes)* must be called with size < BPF_REG_SIZE
4826  smin_val等于 minimum possible (s64)value
4827  smax_val等于 maximum possible (s64)value
4828  umin_val等于 minimum possible (u64)value
4829  umax_val等于 maximum possible (u64)value
4830  src_known等于Returns true if @a is a known constant
4831  dst_known等于Returns true if @a is a known constant
4833  如果src_knownsmin_val不等于smax_valumin_val不等于umax_val的值或smin_val大于smax_valumin_val大于umax_val
4838  Mark a register as having a completely unknown (scalar) value.
4839  返回:0
4842  如果非src_knownopcode不等于BPF_ADDopcode不等于BPF_SUBopcode不等于BPF_AND
4844  Mark a register as having a completely unknown (scalar) value.
4845  返回:0
4849  :opcode恒等于BPF_ADD
4850  ret等于sanitize_val_alu(env, insn)
4851  如果ret小于0则
4852  verbose(env, "R%d tried to add from different pointers or scalars\n", dst)
4853  返回:ret
4859  否则
4867  否则
4872  退出
4873  :opcode恒等于BPF_SUB
4874  ret等于sanitize_val_alu(env, insn)
4875  如果ret小于0则
4876  verbose(env, "R%d tried to sub from different pointers or scalars\n", dst)
4877  返回:ret
4884  否则
4892  否则
4898  退出
4899  :opcode恒等于BPF_MUL
4901  如果smin_val小于0或 minimum possible (s64)value 小于0则
4919  如果 maximum possible (u64)value 大于S64_MAX
4923  否则
4927  退出
4928  :opcode恒等于BPF_AND
4929  如果src_knowndst_known
4940  如果 minimum possible (s64)value 小于0或smin_val小于0则
4946  否则
4955  退出
4956  :opcode恒等于BPF_OR
4957  如果src_knowndst_known
4969  如果 minimum possible (s64)value 小于0或smin_val小于0则
4975  否则
4984  退出
4985  :opcode恒等于BPF_LSH
4986  如果umax_val大于等于insn_bitness
4999  如果 maximum possible (u64)value 大于1ULL左移63减umax_val位则
5002  否则
5009  退出
5010  :opcode恒等于BPF_RSH
5011  如果umax_val大于等于insn_bitness
5039  退出
5041  如果umax_val大于等于insn_bitness
5052  如果insn_bitness恒等于32则
5055  否则
5069  退出
5070  默认
5072  退出
5080  Uses signed min/max values to inform unsigned, and vice-versa
5081  Attempts to improve var_off based on unsigned min/max information
5082  返回:0
调用者
名称描述
adjust_reg_min_max_valsHandles ALU ops other than BPF_END, BPF_NEG and BPF_MOV: computes new min/max* and var_off.