Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Same as above, but for the case that dst_reg holds a constant and src_reg is* the variable reg.

Proto:static void reg_set_min_max_inv(struct bpf_reg_state *true_reg, struct bpf_reg_state *false_reg, u64 val, u8 opcode, bool is_jmp32)

Type:void

Parameter:

TypeParameterName
struct bpf_reg_state *true_reg
struct bpf_reg_state *false_reg
u64val
u8opcode
boolis_jmp32
5701  If __is_pointer_value(TSC's on different sockets may be reset asynchronously.* This may cause the TSC ADJUST value on socket 0 to be NOT 0., false_reg) Then Return
5704  val = If is_jmp32 Then val Else val
5705  sval = If is_jmp32 Then val Else val
5708  Case opcode == BPF_JEQ
5709  Case opcode == jump !=
5711  reg = If opcode == BPF_JEQ Then true_reg Else false_reg
5714  If is_jmp32 Then
5715  old_v = value
5716  hi_mask = ~0xffffffffULL
5718  value = old_v & hi_mask | val
5719  mask &= hi_mask
5720  Else
5723  Break
5725  Case opcode == BPF_JSET
5726  For scalar types (SCALAR_VALUE), this represents our knowledge of * the actual value. * For pointer types, this represents the variable part of the offset * from the pointed-to object, and is shared with all bpf_reg_states * with the same id as us. = Bitwise-AND, return @a & @b
5728  If s_power_of_2() - check if a value is a power of two*@n: the value to check* Determine whether some value is a power of two, where zero is* *not* considered a power of two.* Return: true if @n is a power of 2, otherwise false. Then For scalar types (SCALAR_VALUE), this represents our knowledge of * the actual value. * For pointer types, this represents the variable part of the offset * from the pointed-to object, and is shared with all bpf_reg_states * with the same id as us. = Bitwise-OR, return @a | @b
5731  Break
5732  Case opcode == BPF_JGE
5733  Case opcode == BPF_JGT
5735  false_umin = If opcode == BPF_JGT Then val Else val + 1
5736  true_umax = If opcode == BPF_JGT Then val - 1 Else val
5738  If is_jmp32 Then
5742  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 , false_umin)
5743  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 , true_umax)
5744  Break
5746  Case opcode == SGE is signed '>=', GE in x86
5747  Case opcode == SGT is signed '>', GT in x86
5749  false_smin = If opcode == SGT is signed '>', GT in x86 Then sval Else sval + 1
5750  true_smax = If opcode == SGT is signed '>', GT in x86 Then sval - 1 Else sval
5752  If is_jmp32 && Not Return true if VAL is compared with a s64 sign extended from s32, and they* are with the same signedness. Then Break
5754  minimum possible (s64)value = max - return maximum of two values of the same or compatible types*@x: first value*@y: second value( minimum possible (s64)value , false_smin)
5755  maximum possible (s64)value = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value( maximum possible (s64)value , true_smax)
5756  Break
5758  Case opcode == LE is unsigned, '<='
5759  Case opcode == LT is unsigned, '<'
5761  false_umax = If opcode == LT is unsigned, '<' Then val Else val - 1
5762  true_umin = If opcode == LT is unsigned, '<' Then val + 1 Else val
5764  If is_jmp32 Then
5768  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 , false_umax)
5769  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 , true_umin)
5770  Break
5772  Case opcode == SLE is signed, '<='
5773  Case opcode == SLT is signed, '<'
5775  false_smax = If opcode == SLT is signed, '<' Then sval Else sval - 1
5776  true_smin = If opcode == SLT is signed, '<' Then sval + 1 Else sval
5778  If is_jmp32 && Not Return true if VAL is compared with a s64 sign extended from s32, and they* are with the same signedness. Then Break
5780  maximum possible (s64)value = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value( maximum possible (s64)value , false_smax)
5781  minimum possible (s64)value = max - return maximum of two values of the same or compatible types*@x: first value*@y: second value( minimum possible (s64)value , true_smin)
5782  Break
5784  Default
5785  Break
5788  Uses signed min/max values to inform unsigned, and vice-versa
5789  Uses signed min/max values to inform unsigned, and vice-versa
5791  Attempts to improve var_off based on unsigned min/max information
5792  Attempts to improve var_off based on unsigned min/max information
5793  If is_jmp32 Then
5794  __reg_bound_offset32(false_reg)
5795  __reg_bound_offset32(true_reg)
5801  Attempts to improve min/max values based on var_off information
5802  Attempts to improve min/max values based on var_off information
Caller
NameDescribe
check_cond_jmp_op