函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:heck validity of 32-bit and 64-bit arithmetic operations

函数原型:static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn)

返回类型:int

参数:

类型参数名称
struct bpf_verifier_env *env
struct bpf_insn *insn
5166  regs等于cur_regs(env)
5167  opcode等于alu/jmp fields ( opcode )
5170  如果opcode恒等于lags for endianness conversion: opcode恒等于BPF_NEG
5171  如果opcode恒等于BPF_NEG
5172  如果BPF_SRC( opcode )不等于0或 source register 不等于BPF_REG_0 signed offset 不等于0或 signed immediate constant 不等于0则
5175  verbose(env, "BPF_NEG uses reserved fields\n")
5176  返回:负EINVAL
5178  否则
5182  verbose(env, "BPF_END uses reserved fields\n")
5183  返回:负EINVAL
5188  err等于check_reg_arg(env, dest register , register is used as source operand )
5189  如果err则返回:err
5193  verbose(env, "R%d pointer arithmetic prohibited\n", dest register )
5195  返回:负EACCES
5199  err等于check_reg_arg(env, dest register , register is used as destination operand )
5200  如果err则返回:err
5203  否则如果opcode恒等于mov reg to reg
5205  如果BPF_SRC( opcode )恒等于BPF_X
5206  如果 signed immediate constant 不等于0或 signed offset 不等于0则
5207  verbose(env, "BPF_MOV uses reserved fields\n")
5208  返回:负EINVAL
5213  如果err则返回:err
5215  否则
5216  如果 source register 不等于BPF_REG_0 signed offset 不等于0则
5217  verbose(env, "BPF_MOV uses reserved fields\n")
5218  返回:负EINVAL
5223  err等于check_reg_arg(env, dest register , DST_OP_NO_MARK)
5224  如果err则返回:err
5227  如果BPF_SRC( opcode )恒等于BPF_X
5238  否则
5255  否则
5265  否则
5271  否则如果opcode大于lags for endianness conversion:
5272  verbose(env, "invalid BPF_ALU opcode %x\n", opcode)
5273  返回:负EINVAL
5275  否则
5277  如果BPF_SRC( opcode )恒等于BPF_X
5278  如果 signed immediate constant 不等于0或 signed offset 不等于0则
5279  verbose(env, "BPF_ALU uses reserved fields\n")
5280  返回:负EINVAL
5284  如果err则返回:err
5286  否则
5287  如果 source register 不等于BPF_REG_0 signed offset 不等于0则
5288  verbose(env, "BPF_ALU uses reserved fields\n")
5289  返回:负EINVAL
5294  err等于check_reg_arg(env, dest register , register is used as source operand )
5295  如果err则返回:err
5298  如果opcode恒等于BPF_MODopcode恒等于BPF_DIV的值且BPF_SRC( opcode )恒等于BPF_K signed immediate constant 恒等于0则
5300  verbose(env, "div by zero\n")
5301  返回:负EINVAL
5304  如果opcode恒等于BPF_LSHopcode恒等于BPF_RSHopcode恒等于sign extending arithmetic shift right 的值且BPF_SRC( opcode )恒等于BPF_K
5306  size等于如果Instruction classes ( opcode )恒等于alu mode in double word width 则64否则32
5308  如果 signed immediate constant 小于0或 signed immediate constant 大于等于size
5309  verbose(env, "invalid shift %d\n", signed immediate constant )
5310  返回:负EINVAL
5315  err等于check_reg_arg(env, dest register , DST_OP_NO_MARK)
5316  如果err则返回:err
5319  返回:Handles ALU ops other than BPF_END, BPF_NEG and BPF_MOV: computes new min/max* and var_off.
5322  返回:0
调用者
名称描述
do_check