函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\verifier.c Create Date:2022-07-27 14:10:14
Last Modify:2022-05-19 20:02:10 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:check_subprogs

函数原型:static int check_subprogs(struct bpf_verifier_env *env)

返回类型:int

参数:

类型参数名称
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  如果ret小于0则返回:ret
1201 i小于insn_cnt循环
1202  如果 opcode 不等于BPF_JMP按位或unction call 的值则继续下一循环
1204  如果 source register 不等于when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative* offset to another bpf function则继续下一循环
1206  如果非allow_ptr_leaks
1207  verbose(env, "function calls to other bpf functions are allowed for root only\n")
1208  返回:负EPERM
1210  ret等于add_subprog(env, i + signed immediate constant + 1)
1211  如果ret小于0则返回:ret
1218  insn idx of function entry point 等于insn_cnt
1220  如果level按位与BPF_LOG_LEVEL2则以i小于subprog_cnt循环
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 i小于insn_cnt循环
1228  code等于 opcode
1230  如果Instruction classes (code)不等于BPF_JMPInstruction classes (code)不等于jmp mode in word width 则转到:next
1232  如果alu/jmp fields (code)恒等于unction return alu/jmp fields (code)恒等于unction call 则转到:next
1234  off等于i signed offset 加1
1235  如果off小于subprog_startoff大于等于subprog_end
1236  verbose(env, "jump out of range from insn %d to %d\n", i, off)
1237  返回:负EINVAL
1239  :
1240  如果i恒等于subprog_end减1则
1245  如果code不等于BPF_JMP按位或unction return 的值且code不等于BPF_JMP按位或BPF_JA的值则
1247  verbose(env, "last insn is not an exit or jmp\n")
1248  返回:负EINVAL
1251  cur_subprog自加
1256  返回:0
调用者
名称描述
bpf_check