函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:sanitize_ptr_alu

函数原型: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)

返回类型:int

参数:

类型参数名称
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  如果can_skip_alu_sanitation(env, insn)则返回:0
4526  如果speculative则转到:do_sim
4529  alu_state等于如果off_is_negBPF_ALU_NEG_VALUE否则0
4530  alu_state或等于如果ptr_is_dst_regPossible states for alu_state member. 否则BPF_ALU_SANITIZE_DST
4533  如果retrieve_ptr_limit(ptr_reg, & alu_limit, opcode, off_is_neg)则返回:0
4535  如果update_alu_sanitation_state(aux, alu_state, alu_limit)则返回:负EACCES
4537  do_sim :
4547  如果非ptr_is_dst_reg
4548  tmp等于dst_reg
4549  dst_reg等于ptr_reg
4551  ret等于push_stack(env, insn_idx + 1, insn_idx, true)
4552  如果非ptr_is_dst_regretdst_reg等于tmp
4554  返回:如果非ret则负EFAULT否则0
调用者
名称描述
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