Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:sanitize_ptr_alu

Proto:static int sanitize_ptr_alu(struct bpf_verifier_env *env, struct bpf_insn *insn, const struct bpf_reg_state *ptr_reg, struct bpf_reg_state *dst_reg, bool off_is_neg)

Type:int

Parameter:

TypeParameterName
struct bpf_verifier_env *env
struct bpf_insn *insn
const struct bpf_reg_state *ptr_reg
struct bpf_reg_state *dst_reg
booloff_is_neg
4511  vstate = current verifier state
4512  aux = cur_aux(env)
4513  ptr_is_dst_reg = ptr_reg == dst_reg
4514  opcode = alu/jmp fields ( opcode )
4519  If can_skip_alu_sanitation(env, insn) Then Return 0
4526  If speculative Then Go to do_sim
4529  alu_state = If off_is_neg Then BPF_ALU_NEG_VALUE Else 0
4530  alu_state |= If ptr_is_dst_reg Then Possible states for alu_state member. Else BPF_ALU_SANITIZE_DST
4533  If retrieve_ptr_limit(ptr_reg, & alu_limit, opcode, off_is_neg) Then Return 0
4535  If update_alu_sanitation_state(aux, alu_state, alu_limit) Then Return -EACCES
4537  do_sim :
4547  If Not ptr_is_dst_reg Then
4548  tmp = dst_reg
4549  dst_reg = ptr_reg
4551  ret = push_stack(env, insn_idx + 1, insn_idx, true)
4552  If Not ptr_is_dst_reg && ret Then dst_reg = tmp
4554  Return If Not ret Then -EFAULT Else 0
Caller
NameDescribe
adjust_ptr_min_max_valsHandles 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