Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Implementation details:* bpf_map_lookup returns PTR_TO_MAP_VALUE_OR_NULL* Two bpf_map_lookups (even with the same key) will have different reg->id

Proto:static int process_spin_lock(struct bpf_verifier_env *env, int regno, bool is_lock)

Type:int

Parameter:

TypeParameterName
struct bpf_verifier_env *env
intregno
boolis_lock
3313  regs = cur_regs(env) , reg = regs
3314  cur = current verifier state
3315  is_const = Returns true if @a is a known constant
3316  map = valid when type == CONST_PTR_TO_MAP | PTR_TO_MAP_VALUE | * PTR_TO_MAP_VALUE_OR_NULL
3317  val = value
3319  If Ordering of fields matters. See states_equal() != g points to map element value Then
3320  verbose(env, "R%d is not a pointer to map_value\n", regno)
3321  Return -EINVAL
3323  If Not is_const Then
3324  verbose(env, "R%d doesn't have constant offset. bpf_spin_lock has to be at the constant offset\n", regno)
3327  Return -EINVAL
3329  If Not btf Then
3330  verbose(env, "map '%s' has to have BTF in order to use bpf_spin_lock\n", name)
3333  Return -EINVAL
3335  If Not map_value_has_spin_lock(map) Then
3336  If >=0 valid offset, <0 error == -E2BIG Then verbose(env, "map '%s' has more than one 'struct bpf_spin_lock'\n", name)
3340  Else if >=0 valid offset, <0 error == -ENOENT Then verbose(env, "map '%s' doesn't have 'struct bpf_spin_lock'\n", name)
3344  Else verbose(env, "map '%s' is not a struct type or bpf_spin_lock is mangled\n", name)
3348  Return -EINVAL
3350  If >=0 valid offset, <0 error != val + Fixed part of pointer offset, pointer types only Then
3351  verbose(env, "off %lld doesn't point to 'struct bpf_spin_lock'\n", val + Fixed part of pointer offset, pointer types only )
3353  Return -EINVAL
3355  If is_lock Then
3356  If active_spin_lock Then
3357  verbose(env, "Locking two bpf_spin_locks are not allowed\n")
3359  Return -EINVAL
3361  active_spin_lock = For PTR_TO_PACKET, used to find other pointers with the same variable * offset, so they can share range knowledge. * For PTR_TO_MAP_VALUE_OR_NULL this is used to share which map value we * came from, when one is tested for != NULL. * For PTR_TO_SOCKET thi
3362  Else
3363  If Not active_spin_lock Then
3364  verbose(env, "bpf_spin_unlock without taking a lock\n")
3365  Return -EINVAL
3368  verbose(env, "bpf_spin_unlock of different lock\n")
3369  Return -EINVAL
3371  active_spin_lock = 0
3373  Return 0
Caller
NameDescribe
check_func_arg