Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:verify BPF_LD_IMM64 instruction

Proto:static int check_ld_imm(struct bpf_verifier_env *env, struct bpf_insn *insn)

Type:int

Parameter:

TypeParameterName
struct bpf_verifier_env *env
struct bpf_insn *insn
6199  aux = cur_aux(env)
6200  regs = cur_regs(env)
6204  If ld/ldx fields ( opcode ) != double word (64-bit) Then
6205  verbose(env, "invalid BPF_LD_IMM insn\n")
6206  Return -EINVAL
6208  If signed offset != 0 Then
6209  verbose(env, "BPF_LD_IMM64 uses reserved fields\n")
6210  Return -EINVAL
6213  err = check_reg_arg(env, dest register , register is used as destination operand )
6214  If err Then Return err
6217  If source register == 0 Then
6218  imm = signed immediate constant << 32 | signed immediate constant
6220  Ordering of fields matters. See states_equal() = g doesn't contain a valid pointer
6221  Mark the unknown part of a register (variable offset or scalar value) as* known to have the value @imm.
6222  Return 0
6225  map = array of map's used by eBPF program [ index into used_maps[] ]
6226  mark_reg_known_zero(env, regs, dest register )
6227  valid when type == CONST_PTR_TO_MAP | PTR_TO_MAP_VALUE | * PTR_TO_MAP_VALUE_OR_NULL = map
6229  If source register == BPF_PSEUDO_MAP_VALUE Then
6230  Ordering of fields matters. See states_equal() = g points to map element value
6231  Fixed part of pointer offset, pointer types only = offset from value base address
6232  If map_value_has_spin_lock(map) Then 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 = ++used to generate unique reg IDs
6234  Else if source register == When BPF ldimm64's insn[0] Then
6235  Ordering of fields matters. See states_equal() = g points to struct bpf_map
6236  Else
6237  verbose(env, "bpf verifier is misconfigured\n")
6238  Return -EINVAL
6241  Return 0
Caller
NameDescribe
do_check