Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:check_reg_sane_offset

Proto:static bool check_reg_sane_offset(struct bpf_verifier_env *env, const struct bpf_reg_state *reg, enum bpf_reg_type type)

Type:bool

Parameter:

TypeParameterName
struct bpf_verifier_env *env
const struct bpf_reg_state *reg
enum bpf_reg_typetype
4404  known = Returns true if @a is a known constant
4405  val = value
4406  smin = minimum possible (s64)value
4408  If known && ( val >= Maximum variable offset umax_value permitted when resolving memory accesses.* In practice this is far bigger than any realistic pointer offset; this limit* ensures that umax_value + (int)off + (int)size cannot overflow a u64. || val <= -Maximum variable offset umax_value permitted when resolving memory accesses.* In practice this is far bigger than any realistic pointer offset; this limit* ensures that umax_value + (int)off + (int)size cannot overflow a u64. ) Then
4409  verbose(env, "math between %s pointer and %lld is not allowed\n", string representation of 'enum bpf_reg_type' [type], val)
4411  Return false
4414  If Fixed part of pointer offset, pointer types only >= Maximum variable offset umax_value permitted when resolving memory accesses.* In practice this is far bigger than any realistic pointer offset; this limit* ensures that umax_value + (int)off + (int)size cannot overflow a u64. || Fixed part of pointer offset, pointer types only <= -Maximum variable offset umax_value permitted when resolving memory accesses.* In practice this is far bigger than any realistic pointer offset; this limit* ensures that umax_value + (int)off + (int)size cannot overflow a u64. Then
4415  verbose(env, "%s pointer offset %d is not allowed\n", string representation of 'enum bpf_reg_type' [type], Fixed part of pointer offset, pointer types only )
4417  Return false
4420  If smin == S64_MIN Then
4421  verbose(env, "math between %s pointer and register with unbounded min value is not allowed\n", string representation of 'enum bpf_reg_type' [type])
4423  Return false
4426  If smin >= Maximum variable offset umax_value permitted when resolving memory accesses.* In practice this is far bigger than any realistic pointer offset; this limit* ensures that umax_value + (int)off + (int)size cannot overflow a u64. || smin <= -Maximum variable offset umax_value permitted when resolving memory accesses.* In practice this is far bigger than any realistic pointer offset; this limit* ensures that umax_value + (int)off + (int)size cannot overflow a u64. Then
4427  verbose(env, "value %lld makes %s pointer be out of bounds\n", smin, string representation of 'enum bpf_reg_type' [type])
4429  Return false
4432  Return true
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