Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\verifier.c Create Date:2022-07-28 13:00:54
Last Modify:2022-05-19 20:02:10 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Handles ALU ops other than BPF_END, BPF_NEG and BPF_MOV: computes new min/max* and var_off.

Proto:static int adjust_reg_min_max_vals(struct bpf_verifier_env *env, struct bpf_insn *insn)

Type:int

Parameter:

TypeParameterName
struct bpf_verifier_env *env
struct bpf_insn *insn
5091  vstate = current verifier state
5092  state = call stack tracking [curframe]
5093  regs = regs
5094  struct bpf_reg_state * ptr_reg = NULL, off_reg = {0}
5095  opcode = alu/jmp fields ( opcode )
5098  dst_reg = regs[ dest register ]
5099  src_reg = NULL
5100  If Ordering of fields matters. See states_equal() != g doesn't contain a valid pointer Then ptr_reg = dst_reg
5102  If BPF_SRC( opcode ) == BPF_X Then
5103  src_reg = regs[ source register ]
5110  If opcode == BPF_SUB && allow_ptr_leaks Then
5112  Return 0
5114  verbose(env, "R%d pointer %s pointer prohibited\n", dest register , bpf_alu_string[opcode >> 4])
5117  Return -EACCES
5118  Else
5129  Else if ptr_reg Then
5132  If err Then Return err
5137  Else
5141  Ordering of fields matters. See states_equal() = g doesn't contain a valid pointer
5142  Mark the unknown part of a register (variable offset or scalar value) as* known to have the value @imm.
5143  src_reg = off_reg
5144  If ptr_reg Then Return Handles arithmetic on a pointer and a scalar: computes new min/max and var_off.* Caller should also handle BPF_MOV case separately.* If we return -EACCES, caller may want to try again treating pointer as a* scalar
5150  If WARN_ON_ONCE(ptr_reg) Then
5151  print_verifier_state(env, state)
5152  verbose(env, "verifier internal error: unexpected ptr_reg\n")
5153  Return -EINVAL
5155  If WARN_ON(!src_reg) Then
5156  print_verifier_state(env, state)
5157  verbose(env, "verifier internal error: no src_reg\n")
5158  Return -EINVAL
5160  Return 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.
Caller
NameDescribe
check_alu_opheck validity of 32-bit and 64-bit arithmetic operations