Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:, w, e - match pseudo-code above:

Proto:static int push_insn(int t, int w, int e, struct bpf_verifier_env *env, bool loop_ok)

Type:int

Parameter:

TypeParameterName
intt index of current instruction
intw next instruction
inte edge
struct bpf_verifier_env *env
boolloop_ok
6489  insn_stack = insn_stack
6490  insn_state = insn_state
6492  If edge == FALLTHROUGH && insn_state[ index of current instruction] >= (DISCOVERED | FALLTHROUGH) Then Return 0
6495  If edge == BRANCH && insn_state[ index of current instruction] >= (DISCOVERED | BRANCH) Then Return 0
6498  If next instruction < 0 || next instruction >= Number of filter blocks Then
6499  verbose_linfo(env, index of current instruction, "%d: ", index of current instruction)
6500  verbose(env, "jump out of range from insn %d to %d\n", index of current instruction, next instruction)
6501  Return -EINVAL
6504  If edge == BRANCH Then init_explored_state(env, next instruction)
6508  If insn_state[ next instruction] == 0 Then
6510  insn_state[ index of current instruction] = DISCOVERED | edge
6511  insn_state[ next instruction] = DISCOVERED
6512  If cur_stack >= Number of filter blocks Then Return -E2BIG
6514  insn_stack[cur_stack++] = next instruction
6515  Return 1
6516  Else if (insn_state[ next instruction] & 0xF0) == DISCOVERED Then
6517  If loop_ok && allow_ptr_leaks Then Return 0
6519  verbose_linfo(env, index of current instruction, "%d: ", index of current instruction)
6520  verbose_linfo(env, next instruction, "%d: ", next instruction)
6521  verbose(env, "back-edge from insn %d to %d\n", index of current instruction, next instruction)
6522  Return -EINVAL
6523  Else if insn_state[ next instruction] == EXPLORED Then
6525  insn_state[ index of current instruction] = DISCOVERED | edge
6526  Else
6527  verbose(env, "insn state internal bug\n")
6528  Return -EFAULT
6530  Return 0
Caller
NameDescribe
check_cfg-recursive depth-first-search to detect loops in BPF program* loop == back-edge in directed graph