函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:check_stack_read

函数原型:static int check_stack_read(struct bpf_verifier_env *env, struct bpf_func_state *reg_state, int off, int size, int value_regno)

返回类型:int

参数:

类型参数名称
struct bpf_verifier_env *env
struct bpf_func_state *reg_state func where register points to
intoff
intsize
intvalue_regno
2083  vstate等于current verifier state
2084  state等于 call stack tracking [curframe]
2085  slot等于负off减1, spi等于slot除size of eBPF register in bytes
2089  如果allocated_stack小于等于slot
2090  verbose(env, "invalid read from stack off %d+0 size %d\n", off, size)
2092  返回:负EACCES
2094  stype等于slot_type
2095  reg等于spilled_ptr
2097  如果stype[0]恒等于 register spilled into stack
2098  如果size不等于size of eBPF register in bytes
2100  verbose_linfo(env, insn_idx, "; ")
2101  verbose(env, "invalid size of register fill\n")
2102  返回:负EACCES
2104  如果value_regno大于等于0则
2109  返回:0
2113  verbose(env, "corrupted spill memory\n")
2114  返回:负EACCES
2118  如果value_regno大于等于0则
2120  regs[value_regno]等于reg
2127  Parentage chain of this register (or stack slot) should take care of all* issues like callee-saved registers, stack slot allocation time, etc.
2128  否则
2129  zeros等于0
2131 i小于size循环
2135  zeros自加
2136  继续下一循环
2138  verbose(env, "invalid read from stack off %d+%d size %d\n", off, i, size)
2140  返回:负EACCES
2142  Parentage chain of this register (or stack slot) should take care of all* issues like callee-saved registers, stack slot allocation time, etc.
2143  如果value_regno大于等于0则
2144  如果zeros恒等于size
2160  否则
2167  返回: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 &&