Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\verifier.c Create Date:2022-07-28 12:57:42
Last Modify:2022-05-19 20:02:10 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:check_stack_read

Proto:static int check_stack_read(struct bpf_verifier_env *env, struct bpf_func_state *reg_state, int off, int size, int value_regno)

Type:int

Parameter:

TypeParameterName
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  If allocated_stack <= slot Then
2090  verbose(env, "invalid read from stack off %d+0 size %d\n", off, size)
2092  Return -EACCES
2094  stype = slot_type
2095  reg = spilled_ptr
2097  If stype[0] == register spilled into stack Then
2100  verbose_linfo(env, insn_idx, "; ")
2101  verbose(env, "invalid size of register fill\n")
2102  Return -EACCES
2104  If value_regno >= 0 Then
2109  Return 0
2113  verbose(env, "corrupted spill memory\n")
2114  Return -EACCES
2118  If value_regno >= 0 Then
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  Else
2129  zeros = 0
2131  When i < size cycle
2135  zeros++
2136  Continue
2138  verbose(env, "invalid read from stack off %d+%d size %d\n", off, i, size)
2140  Return -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  If value_regno >= 0 Then
2144  If zeros == size Then
2160  Else
2167  Return 0
Caller
NameDescribe
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 &&