Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:check_subprogs

Proto:static int check_subprogs(struct bpf_verifier_env *env)

Type:int

Parameter:

TypeParameterName
struct bpf_verifier_env *env
1190  cur_subprog = 0
1191  subprog = subprog_info
1192  insn = insnsi
1193  insn_cnt = Number of filter blocks
1196  ret = add_subprog(env, 0)
1197  If ret < 0 Then Return ret
1201  When i < insn_cnt cycle
1202  If opcode != (BPF_JMP | unction call ) Then Continue
1204  If source register != when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative* offset to another bpf function Then Continue
1206  If Not allow_ptr_leaks Then
1207  verbose(env, "function calls to other bpf functions are allowed for root only\n")
1208  Return -EPERM
1210  ret = add_subprog(env, i + signed immediate constant + 1)
1211  If ret < 0 Then Return ret
1218  insn idx of function entry point = insn_cnt
1220  If level & BPF_LOG_LEVEL2 Then When i < subprog_cnt cycle
1222  verbose(env, "func#%d @%d\n", i, insn idx of function entry point )
1225  subprog_start = insn idx of function entry point
1226  subprog_end = insn idx of function entry point
1227  When i < insn_cnt cycle
1228  code = opcode
1230  If Instruction classes (code) != BPF_JMP && Instruction classes (code) != jmp mode in word width Then Go to next
1232  If alu/jmp fields (code) == unction return || alu/jmp fields (code) == unction call Then Go to next
1234  off = i + signed offset + 1
1235  If off < subprog_start || off >= subprog_end Then
1236  verbose(env, "jump out of range from insn %d to %d\n", i, off)
1237  Return -EINVAL
1239  :
1240  If i == subprog_end - 1 Then
1245  If code != (BPF_JMP | unction return ) && code != (BPF_JMP | BPF_JA) Then
1247  verbose(env, "last insn is not an exit or jmp\n")
1248  Return -EINVAL
1251  cur_subprog++
1256  Return 0
Caller
NameDescribe
bpf_check