函数逻辑报告 |
Source Code:kernel\bpf\verifier.c |
Create Date:2022-07-27 14:14:31 |
| Last Modify:2022-05-19 20:02:10 | Copyright©Brick |
| 首页 | 函数Tree |
| 注解内核,赢得工具 | 下载SCCT | English |
函数名称: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
函数原型:static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, struct bpf_insn *insn, const struct bpf_reg_state *ptr_reg, const struct bpf_reg_state *off_reg)
返回类型:int
参数:
| 类型 | 参数 | 名称 |
|---|---|---|
| struct bpf_verifier_env * | env | |
| struct bpf_insn * | insn | |
| const struct bpf_reg_state * | ptr_reg | |
| const struct bpf_reg_state * | off_reg |
| 4567 | vstate等于current verifier state |
| 4568 | state等于 call stack tracking [curframe] |
| 4571 | smin_val等于 minimum possible (s64)value , smax_val等于 maximum possible (s64)value , smin_ptr等于 minimum possible (s64)value , smax_ptr等于 maximum possible (s64)value |
| 4573 | umin_val等于 minimum possible (u64)value , umax_val等于 maximum possible (u64)value , umin_ptr等于 minimum possible (u64)value , umax_ptr等于 maximum possible (u64)value |
| 4575 | dst等于 dest register , src等于 source register |
| 4576 | opcode等于alu/jmp fields ( opcode ) |
| 4590 | 如果Instruction classes ( opcode )不等于alu mode in double word width 则 |
| 4595 | 返回:负EACCES |
| 4600 | verbose(env, "R%d pointer arithmetic on %s prohibited, null-check it first\n", dst, string representation of 'enum bpf_reg_type' [ Ordering of fields matters. See states_equal() ]) |
| 4602 | 返回:负EACCES |
| 4612 | verbose(env, "R%d pointer arithmetic on %s prohibited\n", dst, string representation of 'enum bpf_reg_type' [ Ordering of fields matters. See states_equal() ]) |
| 4614 | 返回:负EACCES |
| 4616 | 如果非allow_ptr_leaks且非known且smin_val小于0不等于smax_val小于0则 |
| 4622 | 默认 |
| 4623 | 退出 |
| 4629 | Ordering of fields matters. See states_equal() 等于 Ordering of fields matters. See states_equal() |
| 4632 | 如果非check_reg_sane_offset(env, off_reg, Ordering of fields matters. See states_equal() )或非check_reg_sane_offset(env, ptr_reg, Ordering of fields matters. See states_equal() )则返回:负EINVAL |
| 4639 | 如果ret小于0则 |
| 4654 | Fixed part of pointer offset, pointer types only 等于 Fixed part of pointer offset, pointer types only 加smin_val |
| 4656 | 退出 |
| 4671 | 否则 |
| 4677 | minimum possible (u64)value 等于0 |
| 4679 | 否则 |
| 4684 | Fixed part of pointer offset, pointer types only 等于 Fixed part of pointer offset, pointer types only |
| 4686 | 如果reg_is_pkt_pointer(ptr_reg)则 |
| 4689 | Max size from any of the above. 等于0 |
| 4691 | 退出 |
| 4694 | 如果ret小于0则 |
| 4722 | Fixed part of pointer offset, pointer types only 等于 Fixed part of pointer offset, pointer types only 减smin_val |
| 4724 | 退出 |
| 4734 | 否则 |
| 4740 | minimum possible (u64)value 等于0 |
| 4742 | 否则 |
| 4748 | Fixed part of pointer offset, pointer types only 等于 Fixed part of pointer offset, pointer types only |
| 4750 | 如果reg_is_pkt_pointer(ptr_reg)则 |
| 4753 | 如果smin_val小于0则 Max size from any of the above. 等于0 |
| 4756 | 退出 |
| 4761 | verbose(env, "R%d bitwise operator %s on pointer prohibited\n", dst, bpf_alu_string[opcode >> 4]) |
| 4763 | 返回:负EACCES |
| 4764 | 默认 |
| 4766 | verbose(env, "R%d pointer arithmetic with %s operator prohibited\n", dst, bpf_alu_string[opcode >> 4]) |
| 4768 | 返回:负EACCES |
| 4771 | 如果非check_reg_sane_offset(env, dst_reg, Ordering of fields matters. See states_equal() )则返回:负EINVAL |
| 4781 | 如果非allow_ptr_leaks则 |
| 4784 | verbose(env, "R%d pointer arithmetic of map value goes out of range, prohibited for !root\n", dst) |
| 4786 | 返回:负EACCES |
| 4796 | 返回:0 |
| 名称 | 描述 |
|---|---|
| adjust_reg_min_max_vals | Handles ALU ops other than BPF_END, BPF_NEG and BPF_MOV: computes new min/max* and var_off. |
| 源代码转换工具 开放的插件接口 | X |
|---|---|
| 支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |