函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:check_ptr_to_btf_access

函数原型:static int check_ptr_to_btf_access(struct bpf_verifier_env *env, struct bpf_reg_state *regs, int regno, int off, int size, enum bpf_access_type atype, int value_regno)

返回类型:int

参数:

类型参数名称
struct bpf_verifier_env *env
struct bpf_reg_state *regs
intregno
intoff
intsize
enum bpf_access_typeatype
intvalue_regno
2855  reg等于regsregno
2856  t等于btf_type_by_id(btf_vmlinux, for PTR_TO_BTF_ID )
2857  tname等于btf_name_by_offset(btf_vmlinux, name_off)
2861  如果atype不等于BPF_READ
2862  verbose(env, "only read is supported\n")
2863  返回:负EACCES
2866  如果off小于0则
2867  verbose(env, "R%d is ptr_%s invalid negative access: off=%d\n", regno, tname, off)
2870  返回:负EACCES
2872  如果非Returns true if @a is a known constant value
2875  Format a tnum as a pair of hex numbers (value; mask)
2876  verbose(env, "R%d is ptr_%s invalid variable offset: off=%d, var_off=%s\n", regno, tname, off, tn_buf)
2879  返回:负EACCES
2882  ret等于btf_struct_access( & log, t, off, size, atype, & btf_id)
2883  如果ret小于0则返回:ret
2886  如果ret恒等于g doesn't contain a valid pointer
2887  mark_reg_unknown(env, regs, value_regno)
2888  返回:0
2890  mark_reg_known_zero(env, regs, value_regno)
2891  Ordering of fields matters. See states_equal() 等于g points to kernel struct
2892  for PTR_TO_BTF_ID 等于btf_id
2893  返回:0
调用者
名称描述
check_mem_accessheck whether memory at (regno + off) is accessible for t = (read | write)* if t==write, value_regno is a register which value is stored into memory* if t==read, value_regno is a register which will receive the value from memory* if t==write &&