Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:xup insn->imm field of bpf_call instructions* and inline eligible helpers as explicit sequence of BPF instructions* this function is called after eBPF program passed verification

Proto:static int fixup_bpf_calls(struct bpf_verifier_env *env)

Type:int

Parameter:

TypeParameterName
struct bpf_verifier_env *env
9139  prog = BPF program being verified
9140  expect_blinding = bpf_jit_blinding_enabled(prog)
9141  insn = insnsi
9143  insn_cnt = Number of filter blocks
9149  delta = 0
9151  When i < insn_cnt cycle
9177  Else
9183  If Not new_prog Then Return -ENOMEM
9186  delta += cnt - 1
9188  insn = insnsi + i + delta
9189  Continue
9197  verbose(env, "bpf verifier is misconfigured\n")
9198  Return -EINVAL
9202  If Not new_prog Then Return -ENOMEM
9205  delta += cnt - 1
9207  insn = insnsi + i + delta
9208  Continue
9216  patch = insn_buf[0]
9237  If issrc Then
9241  Else
9245  If isneg Then opcode = If opcode == code_add Then code_sub Else code_add
9248  patch++ = insn
9251  cnt = patch - insn_buf
9254  If Not new_prog Then Return -ENOMEM
9257  delta += cnt - 1
9259  insn = insnsi + i + delta
9260  Continue
9263  If opcode != (BPF_JMP | unction call ) Then Continue
9265  If source register == when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative* offset to another bpf function Then Continue
9268  If signed immediate constant == BPF_FUNC_get_route_realm Then Do we need dst entry? = 1
9270  If signed immediate constant == BPF_FUNC_get_prandom_u32 Then bpf_user_rnd_init_once()
9272  If signed immediate constant == BPF_FUNC_override_return Then Do we override a kprobe? = 1
9305  If ret < 0 Then
9306  verbose(env, "adding tail call poke descriptor failed\n")
9307  Return ret
9311  Continue
9314  If Not bpf_map_ptr_unpriv(aux) Then Continue
9323  If bpf_map_ptr_poisoned(aux) Then
9324  verbose(env, "tail_call abusing map_ptr\n")
9325  Return -EINVAL
9335  insn_buf[2] = insn
9336  cnt = 3
9338  If Not new_prog Then Return -ENOMEM
9341  delta += cnt - 1
9343  insn = insnsi + i + delta
9344  Continue
9359  If bpf_map_ptr_poisoned(aux) Then Go to patch_call_imm
9368  verbose(env, "bpf verifier is misconfigured\n")
9369  Return -EINVAL
9374  If Not new_prog Then Return -ENOMEM
9377  delta += cnt - 1
9379  insn = insnsi + i + delta
9380  Continue
9425  Go to patch_call_imm
9428  patch_call_imm :
9429  fn = get_func_proto( signed immediate constant , BPF program being verified )
9433  If Not func Then
9434  verbose(env, "kernel subsystem misconfigured func %s#%d\n", func_id_name( signed immediate constant ), signed immediate constant )
9437  Return -EFAULT
9439  signed immediate constant = func - Base function for offset calculation. Needs to go into .text section,* therefore keeping it non-static as well; will also be used by JITs* anyway later on, so do not let the compiler omit it. This also needs* to go into kallsyms for correlation from e
9443  When i < size_poke_tab cycle
9444  map_ptr = map
9445  If Not map_poke_track || Not map_poke_untrack || Not map_poke_run Then
9448  verbose(env, "bpf verifier is misconfigured\n")
9449  Return -EINVAL
9452  ret = map_poke_track(map_ptr, Auxiliary fields )
9453  If ret < 0 Then
9454  verbose(env, "tracking tail call prog failed\n")
9455  Return ret
9459  Return 0
Caller
NameDescribe
bpf_check