函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:look for pseudo eBPF instructions that access map FDs and* replace them with actual map pointers

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

返回类型:int

参数:

类型参数名称
struct bpf_verifier_env *env
8166  insn等于insnsi
8167  insn_cnt等于 Number of filter blocks
8170  err等于bpf_prog_calc_tag(BPF program being verified )
8171  如果err则返回:err
8174 i小于insn_cnt循环
8177  verbose(env, "BPF_LDX uses reserved fields\n")
8178  返回:负EINVAL
8184  verbose(env, "BPF_STX uses reserved fields\n")
8185  返回:负EINVAL
8188  如果 opcode 恒等于BPF_LD按位或BPF_IMM按位或double word (64-bit) 的值则
8194  如果i恒等于insn_cnt减1或 opcode 不等于0或 dest register 不等于0或 source register 不等于0或 signed offset 不等于0则
8197  verbose(env, "invalid bpf_ld_imm64 insn\n")
8198  返回:负EINVAL
8201  如果 source register 恒等于0则转到:next_insn
8212  verbose(env, "unrecognized bpf_ld_imm64 insn\n")
8214  返回:负EINVAL
8219  如果是错误
8220  verbose(env, "fd %d is not pointing to valid bpf_map\n", signed immediate constant )
8222  返回:错误
8226  如果err
8227  fdput(f)
8228  返回:err
8233  addr等于map
8234  否则
8238  verbose(env, "direct value offset of %u is not allowed\n", off)
8239  fdput(f)
8240  返回:负EINVAL
8243  如果非map_direct_value_addr
8244  verbose(env, "no direct value access support for this map type\n")
8245  fdput(f)
8246  返回:负EINVAL
8249  err等于map_direct_value_addr(map, & addr, off)
8250  如果err
8251  verbose(env, "invalid access to map value pointer, value_size=%u off=%u\n", value_size, off)
8253  fdput(f)
8254  返回:err
8258  addr加等于off
8262  signed immediate constant 等于addr右移32位
8265 j小于umber of used maps 循环
8266  如果array of map's used by eBPF program [j]恒等于map
8268  fdput(f)
8269  转到:next_insn
8274  fdput(f)
8275  返回:负E2BIG
8283  bpf_map_inc(map)
8290  verbose(env, "only one cgroup storage of each type is allowed\n")
8291  fdput(f)
8292  返回:负EBUSY
8295  fdput(f)
8296  next_insn :
8297  insn自加
8298  i自加
8299  继续下一循环
8303  如果非bpf_opcode_in_insntable( opcode )则
8304  verbose(env, "unknown opcode %02x\n", opcode )
8305  返回:负EINVAL
8313  返回:0
调用者
名称描述
bpf_check