函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:vert load instructions that access fields of a context type into a* sequence of instructions that access fields of the underlying structure:* struct __sk_buff -> struct sk_buff* struct bpf_sock_ops -> struct sock

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

返回类型:int

参数:

类型参数名称
struct bpf_verifier_env *env
8748  ops等于ops
8749  delta等于0
8750  insn_cnt等于 Number of filter blocks
8757  如果gen_prologueseen_direct_write
8758  如果非gen_prologue
8759  verbose(env, "bpf verifier is misconfigured\n")
8760  返回:负EINVAL
8762  cnt等于gen_prologue(insn_buf, seen_direct_write, BPF program being verified )
8765  verbose(env, "bpf verifier is misconfigured\n")
8766  返回:负EINVAL
8767  否则如果cnt
8769  如果非new_prog则返回:负ENOMEM
8773  delta加等于cnt减1
8777  如果bpf_prog_is_dev_bound( Auxiliary fields )则返回:0
8780  insn等于insnsidelta
8782 i小于insn_cnt循环
8785  如果 opcode 恒等于BPF_LDX按位或BPF_MEM按位或8-bit 的值或 opcode 恒等于BPF_LDX按位或BPF_MEM按位或16-bit 的值或 opcode 恒等于BPF_LDX按位或BPF_MEM按位或32-bit 的值或 opcode 恒等于BPF_LDX按位或BPF_MEM按位或double word (64-bit) 的值则type等于BPF_READ
8790  否则如果 opcode 恒等于BPF_STX按位或BPF_MEM按位或8-bit 的值或 opcode 恒等于BPF_STX按位或BPF_MEM按位或16-bit 的值或 opcode 恒等于BPF_STX按位或BPF_MEM按位或32-bit 的值或 opcode 恒等于BPF_STX按位或BPF_MEM按位或double word (64-bit) 的值则type等于BPF_WRITE
8795  否则继续下一循环
8798  如果type恒等于BPF_WRITE stack slot to be cleared
8817  如果非new_prog则返回:负ENOMEM
8820  delta加等于cnt减1
8822  insn等于insnsiidelta
8823  继续下一循环
8828  如果非convert_ctx_access则继续下一循环
8831  退出
8843  如果type恒等于BPF_WRITE
8844  verbose(env, "Writes through BTF pointers are not allowed\n")
8845  返回:负EINVAL
8848  num_exentries自加
8849  继续下一循环
8850  默认
8851  继续下一循环
8855  size等于BPF_LDST_BYTES(insn)
8864  off等于 signed offset
8865  如果is_narrower_load
8868  如果type恒等于BPF_WRITE
8869  verbose(env, "bpf verifier narrow ctx access misconfigured\n")
8870  返回:负EINVAL
8873  size_code等于16-bit
8874  如果ctx_field_size恒等于4则size_code等于32-bit
8876  否则如果ctx_field_size恒等于8则size_code等于double word (64-bit)
8879  signed offset 等于off按位与size_default减1的差的反
8880  opcode 等于BPF_LDX按位或BPF_MEM按位或size_code
8883  target_size等于0
8888  verbose(env, "bpf verifier is misconfigured\n")
8889  返回:负EINVAL
8892  如果is_narrower_loadsize小于target_size
8913  如果非new_prog则返回:负ENOMEM
8916  delta加等于cnt减1
8920  insn等于insnsiidelta
8923  返回:0
调用者
名称描述
bpf_check