Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:check_reg_arg

Proto:static int check_reg_arg(struct bpf_verifier_env *env, u32 regno, enum reg_arg_type t)

Type:int

Parameter:

TypeParameterName
struct bpf_verifier_env *env
u32regno
enum reg_arg_typet
1428  vstate = current verifier state
1429  state = call stack tracking [curframe]
1430  insn = insnsi + insn_idx
1431  regs = regs
1434  If regno >= BPF has 10 general purpose 64-bit registers and stack frame. Then
1435  verbose(env, "R%d is invalid\n", regno)
1436  Return -EINVAL
1439  reg = regs[regno]
1440  rw64 = This function is supposed to be used by the following 32-bit optimization* code only. It returns TRUE if the source or destination register operates* on 64-bit, otherwise return FALSE.
1441  If t == register is used as source operand Then
1444  verbose(env, "R%d !read_ok\n", regno)
1445  Return -EACCES
1448  If regno == BPF_REG_FP Then Return 0
1451  If rw64 Then mark_insn_zext(env, reg)
1454  Return Parentage chain of this register (or stack slot) should take care of all* issues like callee-saved registers, stack slot allocation time, etc.
1456  Else
1458  If regno == BPF_REG_FP Then
1459  verbose(env, "frame pointer is read only\n")
1460  Return -EACCES
1462  live |= g was written first, screening off later reads
1463  Tracks subreg definition. The stored value is the insn_idx of the * writing insn. This is safe because subreg_def is used before any insn * patching which only happens after main verification finished. = If rw64 Then DEF_NOT_SUBREG Else insn_idx + 1
1464  If t == register is used as destination operand Then mark_reg_unknown(env, regs, regno)
1467  Return 0
Caller
NameDescribe
check_xadd
check_func_arg
check_func_call
check_helper_call
check_alu_opheck validity of 32-bit and 64-bit arithmetic operations
check_cond_jmp_op
check_ld_immverify BPF_LD_IMM64 instruction
check_ld_absverify safety of LD_ABS|LD_IND instructions:* - they can only appear in the programs where ctx == skb* - since they are wrappers of function calls, they scratch R1-R5 registers,* preserve R6-R9, and store return value into R0* Implicit input:* ctx == skb
do_check