Function report |
Source Code:kernel\bpf\verifier.c |
Create Date:2022-07-28 13:00:46 |
Last Modify:2022-05-19 20:02:10 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name: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.
Proto: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)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct bpf_verifier_env * | env | |
struct bpf_insn * | insn | |
struct bpf_reg_state * | dst_reg | |
struct bpf_reg_state | src_reg |
4809 | opcode = alu/jmp fields ( opcode ) |
4813 | insn_bitness = If Instruction classes ( opcode ) == alu mode in double word width Then 64 Else 32 |
4814 | dst = dest register |
4817 | If insn_bitness == 32 Then |
4839 | Return 0 |
4845 | Return 0 |
4850 | ret = sanitize_val_alu(env, insn) |
4851 | If ret < 0 Then |
4855 | If signed_add_overflows( minimum possible (s64)value , smin_val) || signed_add_overflows( maximum possible (s64)value , smax_val) Then |
4859 | Else |
4860 | minimum possible (s64)value += smin_val |
4861 | maximum possible (s64)value += smax_val |
4863 | If minimum possible (u64)value + umin_val < umin_val || maximum possible (u64)value + umax_val < umax_val Then |
4865 | minimum possible (u64)value = 0 |
4867 | Else |
4868 | minimum possible (u64)value += umin_val |
4869 | maximum possible (u64)value += umax_val |
4872 | Break |
4874 | ret = sanitize_val_alu(env, insn) |
4875 | If ret < 0 Then |
4879 | If signed_sub_overflows( minimum possible (s64)value , smax_val) || signed_sub_overflows( maximum possible (s64)value , smin_val) Then |
4884 | Else |
4885 | minimum possible (s64)value -= smax_val |
4886 | maximum possible (s64)value -= smin_val |
4888 | If minimum possible (u64)value < umax_val Then |
4890 | minimum possible (u64)value = 0 |
4892 | Else |
4894 | minimum possible (u64)value -= umax_val |
4895 | maximum possible (u64)value -= umin_val |
4898 | Break |
4901 | If smin_val < 0 || minimum possible (s64)value < 0 Then |
4905 | Break |
4910 | If umax_val > U32_MAX || maximum possible (u64)value > U32_MAX Then |
4915 | Break |
4917 | minimum possible (u64)value *= umin_val |
4918 | maximum possible (u64)value *= umax_val |
4919 | If maximum possible (u64)value > S64_MAX Then |
4923 | Else |
4927 | Break |
4932 | Break |
4938 | minimum possible (u64)value = value |
4939 | maximum possible (u64)value = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value( maximum possible (u64)value , umax_val) |
4940 | If minimum possible (s64)value < 0 || smin_val < 0 Then |
4946 | Else |
4955 | Break |
4960 | Break |
4966 | minimum possible (u64)value = max - return maximum of two values of the same or compatible types*@x: first value*@y: second value( minimum possible (u64)value , umin_val) |
4967 | maximum possible (u64)value = value | mask |
4969 | If minimum possible (s64)value < 0 || smin_val < 0 Then |
4975 | Else |
4984 | Break |
4986 | If umax_val >= insn_bitness Then |
4990 | mark_reg_unknown(env, regs, dest register ) |
4991 | Break |
4999 | If maximum possible (u64)value > 1ULL << 63 - umax_val Then |
5000 | minimum possible (u64)value = 0 |
5002 | Else |
5003 | minimum possible (u64)value <<= umin_val |
5004 | maximum possible (u64)value <<= umax_val |
5009 | Break |
5011 | If umax_val >= insn_bitness Then |
5015 | mark_reg_unknown(env, regs, dest register ) |
5016 | Break |
5035 | minimum possible (u64)value >>= umax_val |
5036 | maximum possible (u64)value >>= umin_val |
5039 | Break |
5040 | Case opcode == sign extending arithmetic shift right |
5041 | If umax_val >= insn_bitness Then |
5045 | mark_reg_unknown(env, regs, dest register ) |
5046 | Break |
5052 | If insn_bitness == 32 Then |
5055 | Else |
5056 | minimum possible (s64)value >>= umin_val |
5057 | maximum possible (s64)value >>= umin_val |
5066 | minimum possible (u64)value = 0 |
5069 | Break |
5070 | Default |
5071 | mark_reg_unknown(env, regs, dest register ) |
5072 | Break |
5075 | If Instruction classes ( opcode ) != alu mode in double word width Then |
5082 | Return 0 |
Name | Describe |
---|---|
adjust_reg_min_max_vals | Handles ALU ops other than BPF_END, BPF_NEG and BPF_MOV: computes new min/max* and var_off. |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |